Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap zoomBitmapSize(Bitmap bitmap, float width, float height) { if (width <= 0 || height <= 0) { return bitmap; } if (bitmap == null) { return null; } Matrix matrix = new Matrix(); matrix.postScale(width / bitmap.getWidth(), height / bitmap.getHeight()); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } }