Reducing Image Quality with ImageMagick

Q

How to reduce image JPEG compression quality to reduce file size? Can I use ImageMagick "convert -quality" command to reduce JPEG compression quality?

✍: FYIcenter.com

A

Yes. You can use ImageMagick "identify -quality" command to control the compression level used in JPEG/MIFE/PNG file format.

For the JPEG and MPEG image formats, quality is 1 (lowest image quality and highest compression) to 100 (best quality but least effective compression). The default is to use the estimated quality of your input image if it can be determined, otherwise 92.

For the MIFF image format, quality/10 is the zlib compression level, which is 0 (worst but fastest compression) to 9 (best but slowest).

For the JPEG-2000 image format, quality is mapped using a non-linear equation to the compression ratio required by the Jasper library. The default quality value 100, a request for non-lossy compression. A quality of 75 results in a request for 16:1 compression.

For the MNG and PNG image formats, the quality value sets the zlib compression level (quality / 10) and filter-type (quality % 10). The default PNG "quality" is 75, which means compression level 7 with adaptive PNG filtering, unless the image has a color map, in which case it means compression level 7 with no PNG filtering.

You can test it out in these steps:

C:\fyicenter>identify -verbose test.jpg
...
  Compression: JPEG
  Quality: 95

C:\fyicenter>convert -quality 85 test.jpg test-85.jpg

C:\fyicenter>identify -verbose test-85.jpg
...
  Compression: JPEG
  Quality: 85

2013-11-18, 6539🔥, 0💬