[Image-SIG] PIL 1.1.6 and convert cmyk jpegs to rgb and writing png files

Michael van Tellingen michaelvantellingen at gmail.com
Mon Dec 15 09:53:05 CET 2008


On Fri, Dec 12, 2008 at 17:55, Kevin Cazabon <kevin at cazabon.com> wrote:
> A couple years ago, a few of us worked on adding multi-threading support to
> key routines in PIL - focusing on the ones that would most likely be CPU
> intensive or long duration operations.  It's a simple fix to release the GIL
> before starting the op, and re-acquire before returning - look at the C code
> for resize, for example.   We didn't get it implemented everywhere, but many
> of the "expensive" operations are now covered.  I'm sure Fred would gladly
> accept patches to add support elsewhere.
>
> Kevin.

Hi Kevin, thanks for the quick reply. I've followed your advice and it
was simpler then I thought. I've attached two patches to this email.
One diff is your old patch I was using to correctly convert CMYK
images to RGB. The other one drops the GIL when saving png images.

Could these be committed to the PIL svn repo after a review?

Thanks,
Michael

>
> On 12 Dec 2008, at 11:34, Michael van Tellingen wrote:
>
>> Hello,
>>
>> I'm currently writing a webapplication which processes images uploaded
>> by users and i'm running into two problems:
>> - Converting a CMYK jpeg image to RGB results in the wrong colors
>> used, i've solved this by patching PIL with the
>>  file attached to
>> http://mail.python.org/pipermail/image-sig/2006-April/003871.html
>>
>> - It seems that writing a PNG image requires the GIL. I convert all
>> uploaded images in a separate thread to PNG
>>  images and while doing so my complete python application becomes
>> really slow, I don't have this problem when
>>  I convert it to JPEG or TIFF. Is this correct? And if so, how hard
>> would it be to solve this problem?
>>
>> Thanks,
>> Michael van Tellingen
>> _______________________________________________
>> Image-SIG maillist  -  Image-SIG at python.org
>> http://mail.python.org/mailman/listinfo/image-sig
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PIL.JpegImagePlugin.diff
Type: text/x-diff
Size: 2141 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20081215/2f682e97/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libImaging.ZipEncode.diff
Type: text/x-diff
Size: 969 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20081215/2f682e97/attachment-0001.diff>


More information about the Image-SIG mailing list