如何根据设备设置isSamplesize?例如对于5MP,8MP,13Mp相机,图像尺寸各不相同。如何处理?
答案 0 :(得分:0)
使用BitmapFactory.Options.inJustDecodeBounds
(Android docs):
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
// now width and height are in options.outWidth and options.outHeight
从那里开始,您可以计算inSampleSize
,here's one example(尚未对其进行测试)