Android examples for android.graphics:Image Load Save
get Image Thumbnail
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.ThumbnailUtils; public class Main{ public static Bitmap getImageThumbnail(String imagePath, int width, int height) { Bitmap bitmap = null;// w w w . j a v a2s .c om BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; bitmap = BitmapFactory.decodeFile(imagePath, options); options.inJustDecodeBounds = false; int h = options.outHeight; int w = options.outWidth; int beWidth = w / width; int beHeight = h / height; int be = 1; if (beWidth < beHeight) { be = beWidth; } else { be = beHeight; } if (be <= 0) { be = 1; } options.inSampleSize = be; bitmap = BitmapFactory.decodeFile(imagePath, options); bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return bitmap; } }