ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> image-sig
image-sig
Re: [Image-SIG] Problem with JPEG and CMYK color space
by kevin other posts by this author
Apr 15 2006 4:35AM messages near this date
Re: [Image-SIG] Problem with JPEG and CMYK color space | Re: [Image-SIG] Problem with JPEG and CMYK color space
Actually, the problem is that PIL also has problems reading CMYK JPEG files 
apparently.  I just proved that by loading your CMYK test files and doing a 
"show", then loading a CMYK TIFF file and doing a show (note that to use 
show, it converts to RGB with the internal conversion, so the colors won't 
be perfect).  The TIFF loaded fine, the JPEG didn't.

The patch I've submitted fixes the problem with saving incorrectly, but 
doesn't fix the reading issue (yet).  So, as long as your source CMYK image 
doesn't come from a JPEG file it's ok (with my invert patch).

I'll see if I can spend some time looking at that this weekend.

Kevin.
----- Original Message ----- 
From: "Cesare Leonardi" <ced@[...].com> 
To: <image-sig@[...].org> 
Sent: Friday, April 14, 2006 9:38 AM
Subject: Re: [Image-SIG] Problem with JPEG and CMYK color space


>  kevin@[...].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
>  the results.
>  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"):
>  http://www.bernispa.com/pil/index.html
> 
>  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
>  the inversion.
> 
>  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,
>  isn't it?
>  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).
> 
>  Regards.
> 
>  Cesare.
>  _______________________________________________
>  Image-SIG maillist  -  Image-SIG@[...].org
>  http://mail.python.org/mailman/listinfo/image-sig
> 
> 
>  


_______________________________________________
Image-SIG maillist  -  Image-SIG@[...].org
http://mail.python.org/mailman/listinfo/image-sig
Thread:
Berni CED
Cesare Leonardi
kevin
kevin
kevin
Cesare Leonardi
Cesare Leonardi
Berni CED
Fredrik Lundh
kevin
Cesare Leonardi
Cesare Leonardi
Steve Holden
kevin
kevin
kevin
Cesare Leonardi
Abel Deuring

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved