Here you can find the source of zoomImg(Bitmap bm, int newWidth, int newHeight)
public static Bitmap zoomImg(Bitmap bm, int newWidth, int newHeight)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap zoomImg(Bitmap bm, int newWidth, int newHeight) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);// w w w . j a v a 2s. c om return newbm; } }