Android examples for Graphics:Bitmap Scale
create Scaled BMP by max length
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap createScaledBMP(Bitmap sourceImg, int maxLength) { int width = sourceImg.getWidth(); int height = sourceImg.getHeight(); int scaleWidth = width > height ? maxLength : width * maxLength / height;//from www . j av a 2s . c o m int scaleHeight = width > height ? height * maxLength / width : maxLength; return Bitmap.createScaledBitmap(sourceImg, scaleWidth, scaleHeight, true); } }