Bad JPEG CMYK subsampling
Posted: 2013-02-03T15:00:40-07:00
(This is probably the same issue observed in this thread.)
Using IM 6.8.2-3 to convert a subsampled (YCbCr) JPEG to CMYK, I get a raw-CMYK JPEG with all channels except the Cyan channel subsampled. That's kind of a silly thing to do, and makes most images pretty blurry.
Raw-CMYK JPEGs should never be subsampled. But IM probably shouldn't write raw-CMYK by default anyway. It should encode it as YCCK, which I think is okay to subsample. I think that can be done by adding the following after "jpeg_set_defaults" in coders/jpeg.c:
Note: To tell YCCK from CMYK, look at the "color transform" field of the APP14 "Adobe" segment (identify won't tell you).
Using IM 6.8.2-3 to convert a subsampled (YCbCr) JPEG to CMYK, I get a raw-CMYK JPEG with all channels except the Cyan channel subsampled. That's kind of a silly thing to do, and makes most images pretty blurry.
Code: Select all
$ convert logo: -quality 80 1.jpg
$ convert 1.jpg -colorspace CMYK 2.jpg
$ identify -verbose 1.jpg|grep sampling
jpeg:sampling-factor: 2x2,1x1,1x1
$ identify -verbose 2.jpg|grep sampling
jpeg:sampling-factor: 2x2,1x1,1x1,1x1
Code: Select all
jpeg_set_defaults(&jpeg_info);
if (jpeg_info.in_color_space == JCS_CMYK) {
jpeg_set_colorspace(&jpeg_info,JCS_YCCK);
}