CZXing
CZXing copied to clipboard
图片压缩计算inSampleSize为什么除以500这个值
`
public static Bitmap getDecodeAbleBitmap(String picturePath) {
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(picturePath, options);
int sampleSize = Math.min(options.outHeight, options.outWidth) / 500;
if (sampleSize <= 0) {
sampleSize = 1;
}
options.inSampleSize = sampleSize;
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(picturePath, options);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
`
这是库中的代码,想问下int sampleSize = Math.min(options.outHeight, options.outWidth) / 500; 为什么要除500,而不是400或者其他