Reputation: 1420
How do i get image thumbnail from the given file path? Here what i am doing
Intent cameraIntent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
On "onActivityResult", i get the image in Intent data.
I want to extract thumbnail info from this image. How do i extract it, so that i can show that thumbnail as preview
Upvotes: 2
Views: 5046
Reputation: 1560
Check out the thumbnail generation routines for media provider: http://developer.android.com/reference/android/media/ThumbnailUtils.html
Bitmap thumbBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(filePath), thumbWidth, thumbHeight);
Upvotes: 1
Reputation: 39942
Check out the thumbnail generation class inside Android itself - http://developer.android.com/reference/android/media/ThumbnailUtils.html
It's available since API level 8.
Upvotes: 0
Reputation: 15573
Once you have the bitmap, you can convert it to a thumbnail using createScaledBitmap (Bitmap src, int dstWidth, int dstHeight, boolean filter) or, for Android2.2 and up, using Bitmap extractThumbnail (Bitmap source, int width, int height).
Upvotes: 2
Reputation: 3847
I think you'll have to get the full image and either scale it, or decode it specifying inSampleSize>1 in BitmapFactory.Options.
Upvotes: 0