I try to resize bitmap from gallery.I wrote some code and i can resize bitmap only static width and height.this is source
public Bitmap getResizedBitmap(Bitmap bm, int newWidth) {
float aspectRatio = (float)bm.getWidth() / (float) bm.getHeight();
int height = Math.round(newWidth / aspectRatio); //based on width it gives height
Matrix matrix = new Matrix();
matrix.postScale(newWidth, height);
Bitmap resizedBitmap = Bitmap.createBitmap(
bm, 0, 0, newWidth, height, matrix, false);
return resizedBitmap;
}
but i want to resize bitmap for example width 800px and auto height.is it a possible to solve this problem in android ? thanks