Java tutorial
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap scaleBitmap(Bitmap bitmap, float scale) { return resizeBitmap(bitmap, (int) (bitmap.getWidth() * scale), (int) (bitmap.getHeight() * scale)); } public static Bitmap resizeBitmap(Bitmap bitmap, int maxSize) { int bigger = bitmap.getWidth() > bitmap.getHeight() ? bitmap.getWidth() : bitmap.getHeight(); if (bigger > maxSize) { float scale = bigger / maxSize; return scaleBitmap(bitmap, scale); } else { return bitmap; } } public static Bitmap resizeBitmap(Bitmap original, int width, int height) { return Bitmap.createScaledBitmap(original, width, height, false); } }