1public static Bitmap resizeImage(Bitmap realImage, float maxImageSize,
2 boolean filter) {
3 float ratio = Math.min(
4 (float) maxImageSize / realImage.getWidth(),
5 (float) maxImageSize / realImage.getHeight());
6 int width = Math.round((float) ratio * realImage.getWidth());
7 int height = Math.round((float) ratio * realImage.getHeight());
8
9 Bitmap newBitmap = Bitmap.createScaledBitmap(realImage, width,
10 height, filter);
11 return newBitmap;
12}