Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap compressBitmap(Bitmap bitmap, int compressFactor) { Matrix matrix = new Matrix(); matrix.postScale(1.0f / compressFactor, 1.0f / compressFactor); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); return bitmap; } }