Always scale to smaller as target size

This commit is contained in:
M66B
2019-02-04 07:39:34 +00:00
parent 6724409255
commit 599c220ef5

View File

@@ -225,7 +225,10 @@ public class Helper {
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
int factor = Math.min(options.outWidth / scaleToPixels, options.outWidth / scaleToPixels);
int factor = 1;
while (options.outWidth / factor > scaleToPixels)
factor *= 2;
if (factor > 1) {
Log.i("Decode image factor=" + factor);
options.inJustDecodeBounds = false;