Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap resizeBitmap(Bitmap bitmap, int maxLength) { if (null == bitmap) return null; int w = bitmap.getWidth(); int h = bitmap.getHeight(); float scale = (float) maxLength / h; Matrix matrix = new Matrix(); matrix.postScale(scale, scale); Bitmap zoomedBitmap = Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true); return zoomedBitmap; } }