Compressor
Compressor copied to clipboard
Definieg maximum size does not work
Hi, setMaxWidth and setMaxSize is only used for image sampling, I don't have the requested image pixel numbers in output. (I've checked in code also).
Im using 2.1.0 version.
I just was checking image sizes and I see the same problem. I have set max height and width but I see pictures with much longer sizes than set
private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
while ((height / inSampleSize) >= reqHeight || (width / inSampleSize) >= reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
this is my solution
I come to write the same @songsongtao , there are any PR with this code that we can vote up?
Same issue, I have setMaxWidth(3072) and setMaxHeight(3072), but the result file size is 2304 x 4096.