Here you can find the source of zoomBitmap(Bitmap bitmap, int width, int height)
public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap zoomBitmap(Bitmap bitmap, int width, int height) { int w = bitmap.getWidth(); int h = bitmap.getHeight(); Matrix matrix = new Matrix(); float scaleWidth = ((float) width / w); float scaleHeight = ((float) height / h); matrix.postScale(scaleWidth, scaleHeight); Bitmap newbmp = Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);/*from w w w .j a v a 2s .c o m*/ return newbmp; } }