我的如下代碼:如何獲得縮略圖如micro_kind
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。
我該如何修改它?
非常有用! XD – KryNaC