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

Berni CED ced at bernispa.com
Mon Apr 10 11:12:28 CEST 2006


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.

The problem was verified with:
- PIL 1.1.5 under Windows 2000 with Python 2.4.3;
- PIL 1.1.4 under Debian GNU/Linux Sarge with Python 2.3.5.

On the following address i have set up a little page with links to
sample images and a python script that trigger the problem:
http://www.bernispa.com/pil/index.html

For me there are different important things to note.

1) The script shows the image passed as parameter in the default image
viewer and then save a copy of it in a new JPEG file: in my test machine
i can see that the image showed is already altered (so some conversion
is already happened) and the saved image is double-altered. To be more
precise, seems that in the saved image the problem is bigger (much
darker picture) as if there is 2 conversions that sums their effects.
Since the image showed in the image viewer is a BMP, i suppose this
behaviour is by design, and all showed images are first converted in
BMP. If it is true i think that should be explained in the handbook,
because it is not obvious that show() make some internal conversion.

2) The test images 02 and 03 are particular: all the other images show
bad during show() and very bad in the saved file. The 02 and 03,
however, seems to show correctly but, as the others, are badly saved.

3) In the script i have inserted a verify() that raises no exception: so
from the PIL point of view, the images are correct.

So i think there is a bug in the code related to JPEG CYMK or there are
some JPEG unsupported feature. What do you think? Some advice?

Regards.

Cesare.




More information about the Image-SIG mailing list