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

Ian Ward ian at excess.org
Sat Nov 28 14:44:08 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

(sorry if this message gets posted twice, I'm resending 20h after my
first attempt)


More information about the Image-SIG mailing list