TIFF CMYK with JPEG compression

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
gursch
Posts: 20
Joined: 2010-05-25T02:41:06-07:00
Authentication code: 8675308

TIFF CMYK with JPEG compression

Post by gursch »

Converting a TIFF CMYK image with JPEG compression to a JPEG corrupts colours. I tested with newest available version.

For example: convert tiff_jpeg_compressed.tif out.jpg

I prepared a sample file: https://dl.dropboxusercontent.com/u/197 ... ressed.tif
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: TIFF CMYK with JPEG compression

Post by magick »

How are the colors corrupted? You can expect some differences because JPEG is a lossy compression algorithm (set quality to 100 to minimize). Your input image includes a custom JPEG quantization table which ImageMagick does not honor. Finally there may be some difference when converting CMYK to sRGB. You may need to include a proper color profile to return proper color results.
gursch
Posts: 20
Joined: 2010-05-25T02:41:06-07:00
Authentication code: 8675308

Re: TIFF CMYK with JPEG compression

Post by gursch »

I think "convert tiff_jpeg_compressed.tif out.jpg" does not change the colour space. It should change the format from tiff to jpeg. But in the resulting jpeg the black channel is missing completely.

Screenshot from the TIFF:
Image

Screenshot from the JPEG created with convert:
Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: TIFF CMYK with JPEG compression

Post by magick »

The black channel in this image is nothing but zeros, try identify -verbose tiff_jpeg_compressed.tif. It appears to be an sRGB image encoded in the CMYK format. We get reasonable results with:
  • convert tiff_jpeg_compressed.tif -set colorspace sRGB image.jpg
gursch
Posts: 20
Joined: 2010-05-25T02:41:06-07:00
Authentication code: 8675308

Re: TIFF CMYK with JPEG compression

Post by gursch »

Thank you very much for the tip.
figge21
Posts: 4
Joined: 2012-09-12T00:11:44-07:00
Authentication code: 67789

Re: TIFF CMYK with JPEG compression

Post by figge21 »

There is definitely an issue with conversion of CMYK TIFF images with JPEG compression in version 6.8.6-9.
After conversion the black channel is blank and the CMY channels are altered, producing a result looking almost like a negative image.

The same image conversion in version 6.7.9-9 produces a correct result.

CMYK TIFF images with other compressions are not affected.
Likewise RGB TIFFs with JPEG compression convert OK in 6.8.6-9.

*Edit*
It seems as though convert actually assumes that the input is RGB instead of CMYK.
C is mapped to R
M is mapped to G
Y is mapped to B
and the black channel is discarded altogether.

This is a screenshot of a simple test image:
Image

which looks like this after conversion in 6.8.6-9:
Image

The original test tiff is here https://dl.dropboxusercontent.com/u/841 ... iginal.tif
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: TIFF CMYK with JPEG compression

Post by dlemstra »

This bug will be fixed in the next release of ImageMagick (6.8.9-10).
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply