Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting Image ThumbNail in Android

I need Thumbnail of an image . I only know about the name of image which is stored in SD card . Can anyone help me.

like image 691
nitin tyagi Avatar asked Jan 01 '13 11:01

nitin tyagi


People also ask

How do I get thumbnails on Android?

Try this. final int THUMBSIZE = 64; Bitmap ThumbImage = ThumbnailUtils. extractThumbnail(BitmapFactory. decodeFile(imagePath), THUMBSIZE, THUMBSIZE);

What is a thumbnail Android?

Thumbnails are minuscule replicas of the images stored in your phone. These smaller versions of your actual images are automatically created by your gallery app and enable you to see small representations of your image in the digital gallery or album.

How do I get the thumbnail from a video URI?

This works for me: Bitmap thumb = ThumbnailUtils. createVideoThumbnail(filePath, Thumbnails. MINI_KIND);


2 Answers

Try this.

final int THUMBSIZE = 64;

Bitmap ThumbImage = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(imagePath), 
                    THUMBSIZE, THUMBSIZE);

Refer this for more details.

like image 107
Chirag Avatar answered Oct 03 '22 08:10

Chirag


Using MediaStore.Images.Thumbnails you can query and get two kinds of thumbnails: MINI_KIND: 512 x 384 thumbnail MICRO_KIND: 96 x 96 thumbnail.

The advantage of using this call is that the thumbnails are cached by the MediaStore. So retrieval would be faster if the thumbnail was previously created.

like image 21
Dheeraj Vepakomma Avatar answered Oct 03 '22 07:10

Dheeraj Vepakomma