TIFF Compression JPG with CMYK

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

Heiler81:

I just downloaded tesbild_CMYK_8Bit_E1_JPG.tif and 104023_121_05.tif from your ftp server. (Had to remember to set the transfer type to image. It's been a while since I last used ftp.)

The program described at http://libvips.blogspot.com/2011/12/tas ... nvert.html detects 104023_121_05.tif as being CMYK without an embedded profile. The result with the default profile (from HP) is strange: some patches look kind of OK, but some background figures become "ghosts," and strange colours run around. P.S. This is why I now think that this may have to do with LZW compression.

The other image (tesbild_CMYK_8Bit_E1_JPG.tif) I can't tell if it looks right because it is some sort of Macbeth colour checker. However, it has an embedded profile, so I'm pretty sure the program converts it just fine. P.S. Not so sure anymore, but it does look normal. Could libtiff/libvips do OK with LZW if it is tagged as such, but not if it's stripped? I'll need to check the EXIF of the 104023_121_05.tif image when I have a minute.

It is trivial to modify the program so it produces something else than sRGB JPEG. I consult for money, and this is a short job.

I opened the 104023_121_05.tif image in nip2 and tried 16 different Adobe CMYK ICC (downloaded from http://www.adobe.com/support/downloads/ ... ileID=3790) in addition to the built in one (from HP). None of them give good results, irregardless of what rendering intent I toggle. I have not tried extracting the ICC which is built into the tesbild_CMYK_8Bit_E1_JPG.tif image.

As you may know, TIFF is sometimes described as "Thousands of Incompatible File Formats" because it comes in all kinds of nonstandard variants. I don't think this is the issue here.

What I think is going on with 104023_121_05.tif is that it was produced with a very unusual CMYK ICC, and because none is embedded, we have no way of knowing how to convert the colours correctly without trying ICCs of various origins, targets and rendering intents until hitting one that just happens to be close to what was used to produce it. Assuming the original one was not so unusual that we'd have to reverse engineer it (through colour remapping).

CMYK is a very broadly defined family of colour profiles: For every ink set and printing medium, a different CMYK...

Quick notes RE: installation of nip2:

I don't think that libvips and nip2 have packaged installation for Solaris (although you may try to google nip2 install solaris). See http://www.vips.ecs.soton.ac.uk/index.p ... =Supported.

Then:

nip2 104023_121_05.tif

Left click on the bar to the left of the thumbnail (to tag it as the input to the next command).

Toolkit -> Colour -> ICC -> Import

There is no embedded profile, so the corresponding toggle does nothing.

If you click on Default Input Profile, you can substitute other ones (nip2 only comes with one CMYK profile, but the button opens a file browser which you can use to select alternates).

As mentioned earlier, none of the Adobe ICCs gave a good result. Neither did the nip2 default.
Last edited by NicolasRobidoux on 2011-12-21T16:47:14-07:00, edited 5 times in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

Forgot to mention:

Even though the final image appears to look fine (can't really tell: see the previous post in this thread), the libvips library, just like ImageMagick, complains:

Code: Select all

./cmyk2srgbjpeg tesbild_CMYK_8Bit_E1_JPG.tif j
vips warning: TIFFReadDirectory: tesbild_CMYK_8Bit_E1_JPG.tif: unknown field with tag 37724 (0x935c) encountered
vips warning: TIFFReadDirectory: tesbild_CMYK_8Bit_E1_JPG.tif: unknown field with tag 37724 (0x935c) encountered
So, maybe my earlier "TIF = Thousands of Incompatible File Formats" comment is more on target than I thought. It looks like something happens in the TIFF reader.

And this may be related to viewtopic.php?f=3&t=16390.
Last edited by NicolasRobidoux on 2011-12-21T14:40:43-07:00, edited 1 time in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

RE: the libtiff error message, see http://forums.thegnomonworkshop.com/sho ... .php?t=959.

LZW compression, I would guess, is not in the open source library since until "recently" it was under an actively litigated patent. I'm sure Adobe could afford to buy a license and consequently add one more format to the TIFF forest, basically incompatible (and impossible to reproduce, at the time, without infringing a patent) with pretty much everything out there.

No idea if this is what is going on with the 104023_121_05.tif image since I don't get the same error message from libTIFF, but it is possible given how it looks (it is plausible that some of the "ghosts" are the result of compression) and the fact that there is no embedded profile, and consequently the compression info may have been stripped as well.

If I am to believe the above post, the fix is to load into Photoshop and save again with LZW compression turned off. (Apologies if I make mistake in these posts: working quickly rather than perfectly.)

P.S. See http://en.wikipedia.org/wiki/Tagged_Image_File_Format.
Last edited by NicolasRobidoux on 2011-12-21T14:55:01-07:00, edited 1 time in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

Heiler81:

I realize that I may have misunderstood your initial query:

Is the problem that you can't read some CMYK TIFFS (and convert them to something else) with, say, ImageMagick, or is the problem that the CMYK TIFFs (or JPEGs) you create with ImageMagick are "wrong" somehow?

All my answers have to do with the first query. If it is relevant to the second, it is only by accident.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

General note:

Putting mysterious error messages into google is usually a good idea.
Heiler81
Posts: 63
Joined: 2009-03-12T01:52:24-07:00
Authentication code: 8675309
Location: Germany, Stuttgart

Re: TIFF Compression JPG with CMYK

Post by Heiler81 »

Hi,

first of all thanks for your help.

the 104023_121_05.tif is a CMYK TIF with JPG compression (Photoshop) and I´ve tried to convert it into a useful jpg image to use it in a web application. I get that kind of images from a service provider (free photographers) and my job is to put them into a web application for the customers. Here I got a application where they upload the original image (104023_121_05.tif) and there is a process which generates jpg previews in 72 150 and 300 dpi to show it in web (Solaris Web Server). The result is that the colors here looks inverted and the preview is not suitable.

So my main question is, is there a way to do that with ImageMagick
indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: TIFF Compression JPG with CMYK

Post by indiego »

Taken from the EXIF Info of 104023_05.tif (Irfanview + Metadata plugin):

ComponentsConfiguration: YCbCr

http://en.wikipedia.org/wiki/YCbCr

I guess this explains the funny colors. But don't ask me how to convert this...I have seen this format only on videos. :o
If you are lucky the photographer has a profile for that camera (Panasonic DMC-TZ5).
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

indiego wrote:...ComponentsConfiguration: YCbCr
...
I have seen this format only on videos. :o
If you are lucky the photographer has a profile for that camera (Panasonic DMC-TZ5).
YCbCr is the standard internal storage format for JPEG compression.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: TIFF Compression JPG with CMYK

Post by NicolasRobidoux »

Heiler81 wrote:...
the 104023_121_05.tif is a CMYK TIF with JPG compression (Photoshop)
...
If this image is something you created yourself, can you please re-create it with a matching embedded profile (unless you have a good reason not to), or else let us know which profile it's produced with?
Post Reply