Bad JPEG CMYK subsampling

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Bad JPEG CMYK subsampling

Post by Jason S »

(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.

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
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:

Code: Select all

  jpeg_set_defaults(&jpeg_info);
  if (jpeg_info.in_color_space == JCS_CMYK) {
    jpeg_set_colorspace(&jpeg_info,JCS_YCCK);
  }
Note: To tell YCCK from CMYK, look at the "color transform" field of the APP14 "Adobe" segment (identify won't tell you).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bad JPEG CMYK subsampling

Post by magick »

We thought libJPEG does the conversion automatically from CMYK to YCCK. However, we'll add the patch and research / test before the next point release.
rgpublic
Posts: 1
Joined: 2013-05-17T08:03:30-07:00
Authentication code: 6789

Re: Bad JPEG CMYK subsampling

Post by rgpublic »

Argh. Stop the presses! I used the wrong server and mixed up versions. It definitely works with the most recent version and the above mentioned patch is included with the source. This just for the record here. Sorry for the confusion. Magician, you can continue with your daily routine...

===
Dear magick, I've got the same problem as the OP. My JPEGs also come out blurred. Is there any update on this? I just downloaded and tried version 6.8.5-6 to no avail. Should this bug be fixed in that version? TIA for clarification
Post Reply