Android examples for Graphics:Bitmap Scale
scale Bitmap To Pixel
//package com.java2s; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { static public Bitmap scaleBitmapToPx(Context context, Bitmap bitmap, float dpX, float dpY) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); return scaleBitmap(bitmap, dpX / width, dpY / height); }/*from www . j a v a 2s .c o m*/ static public Bitmap scaleBitmap(Bitmap bitmap, float scaleX, float scaleY) { Matrix matrix = new Matrix(); matrix.postScale(scaleX, scaleY); return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } }