کد تغییر سایز bitmap
        private int calculateInSampleSize(BitmapFactory.Options options) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int thumbnailY=100; //desire size
int thumbnailX=100; //desire size
int inSampleSize = 1;
if (height > thumbnailY || width > thumbnailX) {
inSampleSize = (int) Math.pow(
2,
(int) (Math.log(Math.min((float) thumbnailY
/ (float) height, (float) thumbnailX
/ (float) width)) / Math.log(0.5)));
Log.i("in scale", "s is " + inSampleSize);
}
return inSampleSize;
}


استفاده هم به این شکل:
            BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, opt);
opt.inSampleSize = calculateInSampleSize(opt);
opt.inJustDecodeBounds = false;
opt.inPreferredConfig = Bitmap.Config.RGB_565;
return BitmapFactory.decodeFile(path, opt)