[Image-SIG] Patch: improved PNG saving speed

Eli Golovinsky gooli at testuff.com
Wed Feb 6 17:42:51 CET 2008


Hi,

I'm working on a screen capturing program and I noticed that it takes
quite a while for PIL to save PNG images. I ran a profiler on the
library and saw that the code that filters the PNG data (lines 133 to
234 in ZipEncode.c) takes about half of the entire compression time.
Removing it speeded up the saving considerably and only increased the
resulting files by about 25%.

I added an option to the save method called 'no_filter' that prevents
the filter code from running. I'm attaching a patch made against the
1.1.6 source kit (http://effbot.org/downloads/Imaging-1.1.6.tar.gz).

Maybe somebody will find it useful someday.

-- 
Eli Golovinsky
www.testuff.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pil-png-no_filter.patch
Type: application/octet-stream
Size: 1324 bytes
Desc: not available
Url : http://mail.python.org/pipermail/image-sig/attachments/20080206/d917a671/attachment.obj 


More information about the Image-SIG mailing list