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