[Image-SIG] Problem with optimize flag and GIF encoder

Ian Ward ian at excess.org
Mon Nov 30 02:26:40 CET 2009

It is listed under 1.2a3/1.2b1 here:

But you're right, I might suggest they generate png thumbnails instead.


Fredrik Lundh wrote:
> Hmm.  PIL doesn't officially support "optimize" for GIF files:
>     http://effbot.org/imagingbook/format-gif.htm
> so maybe this is some partially implemented feature that's been hiding
> in there for ages.  I'm not sure GIF is such a great format for
> thumbnails anyway; maybe the toolkit should be tweaked to render any
> 8-bit thumbnail as PNG instead?
> </F>
> On Sat, Nov 28, 2009 at 5:44 AM, Ian Ward <ian at excess.org> wrote:
>> Hello,
>> I am running python 2.5 and PIL 1.1.6 on Debian Lenny, and I've found
>> that using the optimize flag when creating GIF files can create invalid
>> images.  An example:
>>>>> im = Image.new('RGB', (20,44))
>>>>> im.save('test.gif', optimize=True)
>>>>> im2 = Image.open('test.gif')
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>>  File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1917, in open
>>    raise IOError("cannot identify image file")
>> IOError: cannot identify image file
>> I came across this problem using django-filebrowser, which has
>> optimize=True as a default for creating thumbnails of all image formats..
>> Ian
>> (sorry if this message gets posted twice, I'm resending 20h after my
>> first attempt)
>> _______________________________________________
>> Image-SIG maillist  -  Image-SIG at python.org
>> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list