代码如下:
Bitmap getPreview(String path, int THUMBNAIL_SIZE) {
BitmapFactory.Options bounds = new BitmapFactory.Options();
bounds.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, bounds);
if((bounds.outWidth == -1) || (bounds.outHeight == -1)) {
return null;
}
int originalSize = (bounds.outHeight > bounds.outWidth) ? bounds.outHeight : bounds.outWidth;
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = originalSize / THUMBNAIL_SIZE;
return BitmapFactory.decodeFile(path, opts);
}
但是这段代码只能获取和之前相同的比例。
我想获取 96 * 96 就像 micro_kind 的缩略图,但是不使用 micro_kind。
如何修改?