[Image-SIG] Problem with JPEG and CMYK color space
ced at bernispa.com
Fri Apr 14 09:38:16 CEST 2006
kevin at cazabon.com ha scritto:
> 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.
Thanks all for your responses.
Kevin, i've made some tests following what you've suggested and here is
To obtain the color inversion i've used the function invert() in
ImageChops module. I've added the code and the new sample images in this
page (see "part 2"):
As you can see your suggestion works partially.
Images 02 and 03 (that was particular in "part 1") are the only that
after the inversion looks ok.
All the other images looks less dark, but the color are always different
than the original.
The particular thing to note is that the images produced by the
inversion looks the same as Image.show(). Seems that show() already do
There is another thing that i have noted only now: the images saved by
PIL are often less big than the original. Sometimes much less. For example:
test01: 1435 KB test01-dst: 198 KB test01-dst-invert: 198 KB
test04: 1237 KB test01-dst: 405 KB test01-dst-invert: 405 KB
test08: 1647 KB test01-dst: 777 KB test01-dst-invert: 776 KB
test09: 1715 KB test01-dst: 665 KB test01-dst-invert: 665 KB
test10: 2032 KB test01-dst: 659 KB test01-dst-invert: 659 KB
I can think that PIL optimize the compression, but that difference are
really big. Isn't it suspicious? I expect that saving an image in a new
file without modifications produces a file very similar to the original,
The original images was not produced by me so the author can have used
low compression. I cannot make tests since i haven't a program that can
save in CMYK (Gimp seems not able).
More information about the Image-SIG