How To Resize Image In Android Programmatically

[Solved] How To Resize Image In Android Programmatically | Scala - Code Explorer | yomemimo.com
Question : how to resize image in android programmatically

Answered by : ismail-shaikh

public static Bitmap resizeImage(Bitmap realImage, float maxImageSize, boolean filter) { float ratio = Math.min( (float) maxImageSize / realImage.getWidth(), (float) maxImageSize / realImage.getHeight()); int width = Math.round((float) ratio * realImage.getWidth()); int height = Math.round((float) ratio * realImage.getHeight()); Bitmap newBitmap = Bitmap.createScaledBitmap(realImage, width, height, filter); return newBitmap;
}

Source : | Last Update : Fri, 22 Jan 21

Answers related to how to resize image in android programmatically

Code Explorer Popular Question For Scala