flutter_image_compress 的质量如何
What is the quality in flutter_image_compress
我发现 flutter_image_compress 的质量压缩不是基于百分比。例如,4.58MB 的图像在质量 50 压缩后是 return 590KB。那是不是说质量不是百分比?
参考:https://jtmuller5-98869.medium.com/image-compression-in-flutter-e0585ce960cc
quality
不是百分比。它被传递给底层的 JPEG 压缩器,因此您必须查看底层压缩器如何解释它。但即便如此,也可能没有很好的记录。
例如,在 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
参数上。 Apple 将该参数记录如下:
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 range 0.0
to 1.0
. A value of 1.0
specifies to use lossless compression if destination format supports it. A value of 0.0
implies to use maximum compression.
我发现 flutter_image_compress 的质量压缩不是基于百分比。例如,4.58MB 的图像在质量 50 压缩后是 return 590KB。那是不是说质量不是百分比?
参考:https://jtmuller5-98869.medium.com/image-compression-in-flutter-e0585ce960cc
quality
不是百分比。它被传递给底层的 JPEG 压缩器,因此您必须查看底层压缩器如何解释它。但即便如此,也可能没有很好的记录。
例如,在 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
参数上。 Apple 将该参数记录如下:
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.