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

Edward Cannon edward at unicornschool.org
Wed Jun 1 01:55:30 CEST 2011


I get the same issue on windows 7 python 2.6.4. Both gimp and Internet
Explorer don't like the image. Does seem like some sort of patch is in
order, and perhaps a note in the documentation, which does not mention
optimize under the GIF specific notes. It does say elsewhere that "If
a writer doesn't recognize an option it is silently ignored" which
should probably be done in this case. If the GIF writer does support
optimize, the documentation should say that explicitly.
Edward Cannon
Unicorn School

On Tue, May 31, 2011 at 3:53 PM, Mark Doliner <mark at kingant.net> wrote:
> 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
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>


More information about the Image-SIG mailing list