Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap scaleImg(Bitmap bm, int newWidth, int newHeight) { int width = bm.getWidth(); int height = bm.getHeight(); int newWidth1 = newWidth; int newHeight1 = newHeight; float scaleWidth = ((float) newWidth1) / width; float scaleHeight = ((float) newHeight1) / height; Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true); return newbm; } }