[Image-SIG] Problem with JPEG and CMYK color space

kevin at cazabon.com kevin at cazabon.com
Thu Apr 13 21:52:30 CEST 2006


When saving a CMYK file to JPG, PIL seems to invert the colors.  I've 
submitted a patch to Fredrik already for this, and it should be in the next 
major build.

Adding a simple invert to the image before saving will help.

Kevin.
----- Original Message ----- 
From: "abel deuring" <adeuring at gmx.net>
To: "Cesare Leonardi" <ced at bernispa.com>
Cc: <image-sig at python.org>
Sent: Thursday, April 13, 2006 1:58 PM
Subject: Re: [Image-SIG] Problem with JPEG and CMYK color space


> 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:
>>>http://mail.python.org/pipermail/image-sig/2001-July/001514.html
>>>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
>>>correctly.
>>
>> No one can confirm or add some info? It's a known problem? Fredrik?
>
> Cesare,
>
> 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.
>
> Abel
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>
> 




More information about the Image-SIG mailing list