Java tutorial
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap resizeBitmap(Bitmap src, int max) { if (src == null) return null; int width = src.getWidth(); int height = src.getHeight(); float rate = 0.0f; if (width > height) { rate = max / (float) width; height = (int) (height * rate); width = max; } else { rate = max / (float) height; width = (int) (width * rate); height = max; } return Bitmap.createScaledBitmap(src, width, height, true); } }