Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.util.Log; public class Main { public static Bitmap autoResizeByHeight(Bitmap bitmap, int height) { float w = bitmap.getWidth(); float h = bitmap.getHeight(); int width = (int) (w / h * height); return resize(bitmap, width, height); } public static Bitmap resize(Bitmap bitmap, int width, int height) { Log.e("bmhelper", width + " " + height); return Bitmap.createScaledBitmap(bitmap, width, height, true); } }