I found that the quality compress by flutter_image_compress is not based on percentage. For example like 4.58MB image after compress with quality 50 is return 590KB. Is that mean the quality is not precentage ?
Reference : https://jtmuller5-98869.medium.com/image-compression-in-flutter-e0585ce960cc
The quality
is not a percentage. It's passed through to the underlying JPEG compressor, so you have to look at how that underlying compressor interprets it. But even that might not be well-documented.
For example, on iOS, the implementation divides quality
by 100 to convert it to a number in the range 0.0 to 1.0 and uses the resulting fraction as the kCGImageDestinationLossyCompressionQuality
parameter. Apple documents that parameter as follows:
The desired compression quality to use when writing to an image destination. If present, the value associated with this key must be a
CFNumberRef
data type in the range0.0
to1.0
. A value of1.0
specifies to use lossless compression if destination format supports it. A value of0.0
implies to use maximum compression.
You might also want to read the JPEG image compression FAQ answer about quality.