[Image-SIG] Problem with JPEG and CMYK color space
adeuring at gmx.net
Thu Apr 13 13:58:20 CEST 2006
Cesare Leonardi wrote:
> Berni CED ha scritto:
>>I have encountered several images that are not managed well by PIL.
>>Exactly as explainded by the following old mail (which had received no
>>reply) colors are darker and, in general, different from the original:
>>And like in that mail, my problematic images have one thing in common:
>>they are JPEG using the CMYK color space. JPEG in RGB are elaborated
> No one can confirm or add some info? It's a known problem? Fredrik?
I can confirm the problems, though I have no idea, why the files
written by PIL have completely wrong colours.
Regarding the altered colours of the image displayed by im.show()
[disclaimer: I'm writing this without actually having a look into
the PIL sources, so I can easily be wrong...]: The changes are
probably caused by a very simple conversion from CMYK to RGB, like
C = 1 - R, M = 1 - G, Y = 1 - B. Both CMYK and RGB are device
dependant color spaces, i.e., if you use two different monitors, and
let them display some pixels with identical RGB values, the
displayed colours are not exactly identical. The same holds for CMYK
colours: Two different ink jet printers will most likely show
slightly different colours for the same CMYK value. And offset
printing machines (for which most CYMK TIFF/JPEG files are intended)
will produce even other colours.
For a decent RGB <-> CMYK conversion (which you simply need, if you
want to display a CMYK image on a CRT or LCD monitor), I'd recommend
to use ICC profiles. An ICC profile provides a kind of "colour
description" for a certain device, like a CRT monitor, an inkjet
printer, a scanner or a digital camera. You'll find more information
on ICC at http://www.color.org. A very good free implementation of
ICC based colour conversions is Littlecms
(http://www.littlecms.com). Aside from a library for ICC colour
conversions, littlecms also provides programs for RGB<->CMYK
conversions of JPEG and TIFF images. The littlecms web site has also
many useful links to other ICC resources.
More information about the Image-SIG