Page 1 of 1

Specify maximum JPEG quality

Posted: 2014-11-12T10:03:10-07:00
by whugemann
I see no way to specify the maximum (or minimal) JPEG quality. I often do bulk conversions of JPEG photographs, reducing their size in order to embed them in a Word document. The JPEG quality of normal photographs is something like 95%, so if I specify '-quality 90%', the bulk-converted photographs will become smaller (in addition to their reduced dimensions).

But sometimes the original quality is much lower, because the photograph were pre-processed by some software. In this case, the above mentioned option would result in a higher JEPG quality than actually needed. So I would like to have an option like '-quality <90%', denoting: if it's higher than 90%, reduce it to 90%, but if it's lower, keep it as it is, i.e. this option would work correspondingly to the options in regard to image dimensions.

But I think that at the moment there is nothing like this built into ImageMagick (?).

Re: Specify maximum JPEG quality

Posted: 2014-11-12T10:45:21-07:00
by snibgo
whugemann wrote:But I think that at the moment there is nothing like this built into ImageMagick (?).
I think you are right.

You can specify a maximum size, eg -define jpeg:extent=400KB, and IM will choose the highest quality within that size. Your script could then examine the output quality. If higher than 90, the script would re-compress with "-quality=90".

Re: Specify maximum JPEG quality

Posted: 2014-11-12T12:06:39-07:00
by fmw42
If IM finds the quality in the jpg meta data, it uses it. It only uses the default 92, when it cannot find a quality in the original jpg. see http://www.imagemagick.org/script/comma ... hp#quality.

However, your suggestion is still useful.