[Image-SIG] Creating a 187x250 thumbnail from this (CMYK) JPG results in a 1.91 MB PNG; 32-bit data written instead of reported 24-bit?

Eric svvampy at gmail.com
Thu Jun 9 15:03:31 CEST 2011


Hi C.,

I've had a look at your files and the size problem you're having with your
PIL generated thumbnails is that they have an embedded colour profile.

I don't know how to remove embedded colour profiles in PIL, I use
GraphicsMagick <http://www.graphicsmagick.org/> for some other things and it
has a convenient method to remove embedded colour profiles. According to gm,
the embedded colour profile is 2,129,216 bytes
gm convert <infile> +profile "*" <outfile>
When I run that on the thumbnail you've generated and again to ensure gm
isn't doing anything else significant:
>gm convert "MISSONI CAMELEON MET KAP_39L_250px_PIL_1.1.7.png" +profile "*"
thumb_no_profile.png
>gm convert "MISSONI CAMELEON MET KAP_39L_250px_PIL_1.1.7.png"
thumb_control.png

C:\Temp\resize>dir thumb*
 Volume in drive C has no label.
 Volume Serial Number is X

 Directory of C:\Temp\resize

09/06/2011  10:23 PM         1,900,687 thumb_control.png
09/06/2011  10:22 PM            36,305 thumb_no_profile.png
               2 File(s)      1,936,992 bytes
               0 Dir(s)  X bytes free
Additionally, if the colour profile is removed from the jpeg source, the
subsequent PNGs won't magically recreate it, however the colours are
different*. Which makes sense.

I just tried using Image.resize on the original image as Charlie suggested,
unfortunately the colour profile is embedded in the returned image and the
original aspect ratio is lost (this is expected with resize). Perhaps you
need to use some other method of copying the pixel data. I'm sure the list
subscribers would be interested in your discoveries.

Cheers,
Eric

* according to the channel statistics anyway, probably not different by
much, but I'm no expert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110609/9a3b6006/attachment.html>


More information about the Image-SIG mailing list