[Image-SIG] Saving gifs with optimize=True results in bad image

Mark Doliner mark at kingant.net
Wed Jun 1 00:53:23 CEST 2011


Using Python "2.7.1+" on Ubuntu 11.04 I seem to be getting a corrupt
image when saving a gif with the flag optimize=True.  I'm able to
reproduce the problem using the attached image and this code:

> import PIL.Image
> PIL.Image.open('test.gif').save('optimized.gif', 'GIF', optimize=True)

Gimp complains if I try to open optimized.gif.  I mostly just want to
make sure people are aware of the problem.  I found similar reports of
this here:
http://mail.python.org/pipermail/image-sig/2009-November/006007.html
And here:
http://groups.google.com/group/djangofilebrowser/browse_thread/thread/2c5df624ea350c24

Someone in the first email thread mentions that gif doesn't officially
support optimize for gif files.  And that sounds good... but maybe it
would be better if PIL ignored the attribute instead of creating this
seemingly invalid image?

--Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.gif
Type: image/gif
Size: 746 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110531/dc89e7ff/attachment.gif>


More information about the Image-SIG mailing list