Java tutorial
//package com.java2s; import android.graphics.Bitmap; public class Main { public static int getHeight(Bitmap btm, int newWidth) { float btmW = btm.getWidth(); float btmH = btm.getHeight(); // float scale=(btmW-newWidth)/btmW; // return (int)(btmH-btmH * scale); float scale = btmH / btmW; return (int) (newWidth * scale); } }