Page 1 of 1

JPEG -quality & -sampling-factor

Posted: 2013-05-28T02:57:45-07:00
by GreenKoopa
http://www.imagemagick.org/script/comma ... hp#quality
When the quality is greater than 90, then the chroma channels are not downsampled.

http://www.imagemagick.org/Usage/formats/#jpg_write
However when "quality" is 90 or higher, the channels are not sub-sampled.

The documentation does not make clear that -quality does reset -sampling-factor if it has been set previously. This is least clear when it is set implicitly by an input image. Here the sampling factor is determined by in.jpg, not -quality:
convert in.jpg -quality ## out.jpg

For images not in Y'CBCR, this is a huge problem. Here out.jpg is blurry:
convert wizard: in.jpg
convert in.jpg -colorspace CMYK out.jpg
For a user who hasn't set -quality and has never used -sampling-factor, this resulting blur is difficult to understand.

Bug or documentation issue, let me know and I'll respond to these users appropriately. These two forum topics brought this issue to attention:

bizarre drop in quality on no-op convert on small JPEG - by bugbear
viewtopic.php?f=1&t=21934&p=93593

RGB JPEG to CMYK JEPEG looks much too dark and blurry - by dschroeder
viewtopic.php?f=1&t=23474


ImageMagick 6.8.5-6 2013-05-10 Q16 on Windows 7

Re: JPEG -quality & -sampling-factor

Posted: 2013-05-28T04:39:11-07:00
by snibgo
Thanks for this, GK. With a bit of experimentation, it seems the general advice should be:

"If you get blurring in an output JPG file, insert "-sampling-factor 1x1" immediately before the output filename. However, this will also increase the file size."

Is that good advice? If so, perhaps Anthony can add it to documentation.