public int calculateInSampleSize(BitmapFactory.Options option, int rWidth, int rHeight) { final int width = option.outWidth; final int height = option.outHeight; option.inSampleSize = 1;
while ((height / option.inSampleSize) > rHeight || (width / option.inSampleSize) > rWidth) { option.inSampleSize *= 2; } return option.inSampleSize; } |