Android examples for Graphics:Bitmap Scale
stretch Bitmap
//package com.book2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap stretch(Bitmap bm, float newWidth, float newHeight) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = newWidth / width; float scaleHeight = newHeight / height; Matrix matrix = new Matrix(); matrix.postScale(scaleWidth, scaleHeight); Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);// w ww .ja v a 2s . c o m bm.recycle(); return newbm; } }