I would like to scale a Bitmap to a runtime dependant width and height, where the aspect ratio is maintained and the Bitmap fills the entire width
simpler solution : note we set the width to 500 pixels
public void scaleImageKeepAspectRatio()
{
int imageWidth = scaledGalleryBitmap.getWidth();
int imageHeight = scaledGalleryBitmap.getHeight();
int newHeight = (imageHeight * 500)/imageWidth;
scaledGalleryBitmap = Bitmap.createScaledBitmap(scaledGalleryBitmap, 500, newHeight, false);
}