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

Ian Ward ian at excess.org
Fri Nov 27 17:34:04 CET 2009


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



More information about the Image-SIG mailing list