我怎样才能知道使用graphicsmagick读取图像的jpeg质量
当我使用 Magick::readImages(...) 函数读取 jpeg 图像时。 我如何知道图像的估计 jpeg 质量? 我知道当我想写入图像时如何设置质量,但它与原始图像的质量无关,例如: 当我读取一张质量为 80% 的 jpeg 图像并使用 90% 质量写入它时,我将得到比原始图像更大的图像,因为 90% 不是原始 80% 中的 90%。 我如何知道读取图像的 jpeg 质量?
When I read a jpeg image using Magick::readImages(...) function.
How can I know the estimated jpeg quality of the image?
I know how to set the quality when I wanna write the image, but it is not relevant to the quality of the original image, so for example:
when I read a jpeg image that its quality is 80% and I write it using 90% quality I will get a bigger image than the original one, since the 90% is not 90% out of the original 80%.
How can I know the jpeg quality of the read image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是不可能的,期间。 JPEG 质量设置只是传递给编码器的一个数字,它会影响编码器处理数据的方式。
它甚至不是任何内容的百分比 - 它只是一些影响编码器操纵和转换数据的积极程度的设置。无论您在哪里看到JPEG 质量附近的百分号,请忽略它 - 它在那里毫无意义。
因此,无论使用哪种编码器,都无法找到编码器用于生成该图像的JPEG 质量设置值。唯一的方法是获取原始版本并尝试所有合理可能的设置值,直到达到相同的结果。
This is impossible, period. The JPEG quality settings is just a number that is passed to the encoder and affects how the encoder treats the data.
It's not even percentage of anything - it is just some setting that affects how aggressively the encoder manipulates and transforms data. Wherever you see the percent sign near JPEG quality just ignore it - it's meaningless there.
So regardless of the encoder it is impossible to find which JPEG quality settings value the enocder used to produce this very image. The only way would be to obtain the original and try all reasonably possible setting values until you hit the same result.
对于 GraphicsMagick(或 ImageMagick)来说,这既不是不可能也不是困难。类型
并在输出中查找该行
如果图像是由 Independent JPEG Group 软件创建的)或
否则。
您还可以使用
并查看
线;然而,这并不能区分精确质量和近似质量。
It is neither impossible nor difficult with GraphicsMagick (or with ImageMagick). Type
and look in the output for the line
if the image was created by Independent JPEG Group software or
otherwise.
You can also use
and look at the
line; however, this doesn't distinguish between exact and approximate qualities.
这是可能的,但很困难。代码必须像人们一样检查图像。这是关于该主题的论文 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.4.4621&rep=rep1&type=pdf
It's possible but difficult. The code has to examine the image just like people do. Here's a paper on the subject http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.4.4621&rep=rep1&type=pdf
如果要读取 JPEG 元数据,可以在命令行中使用以下命令:
在 C++ 中,可能使用
IdentifyImage
:https://imagemagick.org/api/MagickCore/identify_8c.html#a91079e7db05c1bad53b2dbb2b01f41baThat said, as other users said, it's just a number generated by生成图像的软件。事实上,我可以看到 GM 1.4 在没有配置文件信息的 JPEG 上不返回任何内容,但 GM 1.3.35 对
jpeg.c/EstimateJPEGQuality/932/Coder
(返回100%)。If you want to read the JPEG metadata, you can use the following in command-line:
In C++, it might be using
IdentifyImage
: https://imagemagick.org/api/MagickCore/identify_8c.html#a91079e7db05c1bad53b2dbb2b01f41baThat said, as other users said, it's just a number generated by the software that produced the image. As a matter of fact, I can see that GM 1.4 returns nothing on a JPEG without profile information, but GM 1.3.35 does a wild guess with
jpeg.c/EstimateJPEGQuality/932/Coder
(that returns 100%).