如何从 IIOMetadata 获取图像压缩质量?
使用 ImageIO
保存新图像时,通用 ImageWriteParam
支持显式设置 compressionQuality
参数,范围为 0.0f
(高压缩) ) 到 1.0f
(高质量),无论使用何种图像压缩算法(例如 png、jpeg、gif)。
- 有没有办法从现有图像中读取
compressionQuality
? compressionQuality
写入参数是否只是对ImageWriter
的提示,并且没有存储在图像元数据中的任何位置?如果这是真的,图像处理软件(例如 GIMP)如何设法在“另存为”对话框中提供以下选项?
我设法从 ImageInputStream
读取 IIOMetadata
并迭代它的 metadataFormatNames
以不同的 XML 格式(通常是本机和标准 javax_imageio_1.0
)打印图像元数据。尽管我在那里找不到任何图像compressionQuality
的指示。
When saving a new image with ImageIO
generic ImageWriteParam
supports explicit setting of compressionQuality
parameter from range 0.0f
(high compression) to 1.0f
(high quality) regardless of image compression algorithm used (eg. png, jpeg, gif).
- Is there any way to read
compressionQuality
from an existing image? - Is that
compressionQuality
write parameter just a hint toImageWriter
and is not stored anywhere in image's metadata? If that's true how image processing software (e.g. GIMP) manages to provide the following option in 'Save As' dialog?
I managed to read IIOMetadata
from ImageInputStream
and iterate through its metadataFormatNames
to print out image metadata in different XML formats (native and standard javax_imageio_1.0
, usually). Although I couldn't find any indication of image's compressionQuality
in there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为压缩质量与图像元数据一起存储,这只是处理参数。
I don't think that compressionQuality is stored with image meta data, this is processing parameter only.