Created
August 1, 2014 14:03
-
-
Save SpiritOfDarkDragon/5814cd4c3f15c4633e11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Bitmap resizeImage(Bitmap inputBitmap, int newHeight, int newWidth) { | |
int width = inputBitmap.getWidth(); | |
int height = inputBitmap.getHeight(); | |
float scaleWidth = ((float) newWidth) / width; | |
float scaleHeight = ((float) newHeight) / height; | |
Matrix matrix = new Matrix(); | |
matrix.postScale(scaleWidth, scaleHeight); | |
return Bitmap.createBitmap(inputBitmap, 0, 0, width, height, matrix, false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment