Open shanvpz opened 5 years ago
Yeah, looks like they just ignored. For my case width and height changed, but not in the numbers I set for Compressor.
same
The parameters for setMaxWidth
and setMaxHeight
work differently than their names may suggests.
They define the minimum required width and height of the compressed image. Downsampling happens by the power of 2, so the image size will be divided by 2 until the minimum height or weight is reached. But because these are the minimum values for width and height, the image will not be smaller than these values but always larger. Depending on how close the downsampling comes to these values, the final image width and height can be more or less above these values.
Funny enough, the variable names that are set with setMaxWidth
and setMaxHeight
are reqWidth
and reqHeight
, so only the method names are confusing.
This library currently does not provide a way to set the max height and width where the final image size would not exceed these values.
you can try my library: https://github.com/Shouheng88/Compressor
这个问题还没解决吗?
when i tried custom compress, the height and widths are not changing, file size ok.