Graphicsmagick在压缩jpg时提供更高的文件大小 [英] Graphicsmagick gives higher filesize when compressing jpg

查看:268
本文介绍了Graphicsmagick在压缩jpg时提供更高的文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我将 lena512color.tiff 转换为jpg然后我以90%的质量运行它.在降低质量文件大小后感到惊讶.我在这里做错了什么?

First i took lena512color.tiff amd converted it to jpg and then i ran mogrify on it with a quality of 90%.Surprising after i decrease the quality filesize is higher.What am I doing wrong here ?

gm convert lena512color.tiff lena512color.jpg # filesize = 37,043
gm mogrify  -quality 90 lena512color.jpg # filesize = 58,132

推荐答案

默认情况下,输出质量设置为 GraphicsMagick 认为输入文件的质量.因此,我认为它认为TIFF的质量低于90,而您实际上是在增加设置.

By default, the output quality is set to whatever GraphicsMagick thinks the quality of the input file is. So I guess it thinks the TIFF's quality is lower than 90 and you are actually increasing the setting.

您可以使用以下命令查看 GraphicsMagick 对图像质量的感知:

You can use the following command to see what GraphicsMagick perceives the quality of an image to be:

identify -format %Q someImage.jpg
90

如果您的目标是限制生成的JPEG的大小,则可以使用以下-define设置目标大小:

If your aim is to limit the size of the resulting JPEG, you can use the following -define to set the target size:

convert in.jpg -define jpeg:extent=50KB out.jpg

结果

-rw-r--r--    1 mark  staff  49802 30 Oct 12:38 out.jpg

convert a.jpg -define jpeg:extent=30KB out.jpg

结果

-rw-r--r--    1 mark  staff  28996 30 Oct 12:38 out.jpg

这篇关于Graphicsmagick在压缩jpg时提供更高的文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆