Graphicsmagick gives higher filesize when compressing jpg

喜你入骨 提交于 2019-12-12 05:37:03

问题


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

回答1:


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.

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

identify -format %Q someImage.jpg
90

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

Result

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

Or

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

Result

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


来源:https://stackoverflow.com/questions/40328160/graphicsmagick-gives-higher-filesize-when-compressing-jpg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!