Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize Image in Android?

Tags:

android

bitmap

I am creating an application and want to setup a gallery view. I do not want the images in the gallery view to be full size. How do I resize images in Android?

like image 582
Jignesh Ansodariya Avatar asked May 02 '12 12:05

Jignesh Ansodariya


People also ask

How do I resize a photo in Photo Gallery?

Once your image appears in Photo Gallery, right hand mouse button click on it. Then click on “Resize” in the menu that popped up. 5. In the new window, click on the downward facing arrow under “Select a size” to select the new size for your image.


1 Answers

Try:

Bitmap yourBitmap; Bitmap resized = Bitmap.createScaledBitmap(yourBitmap, newWidth, newHeight, true); 

or:

resized = Bitmap.createScaledBitmap(yourBitmap,(int)(yourBitmap.getWidth()*0.8), (int)(yourBitmap.getHeight()*0.8), true); 
like image 161
goodm Avatar answered Oct 02 '22 11:10

goodm