[Image-SIG] PIL 1.0b1 and GifImagePlugin.py

Steve Purcell steve@websentric.com
Mon, 08 Mar 1999 14:46:36 +0000

Re: Daniel Walton's reported error with local/global palettes in GIF
images, namely:

	File "/usr/local/lib/python1.5/site-packages/PIL/GifImagePlugin.py",
	109, in seek
	    self.palette = self.global_palette
	AttributeError: global_palette

I have also experienced this error for the first time today, and have a
patch to offer.  It seems to work for his sample image and those with
global palettes, but I didn't test exhaustively (with, for example,
animated GIFs).  The innocuous patch is to insert the following at line
78 of 'GifImagePlugin.py':

	    self.global_palette = None

as a counterpart to the 'if' on line 73:

	if flags & 128:

Works for me.  Hope this helps Daniel and/or others somehow.

BTW, a ready source of these local-palette images is the GIF encoder
built into the MS Office 2000 preview.  These images also confuse the
well-known 'xv' viewer, so PIL is in somewhat illustrious company on
this issue.



Steve Purcell            |  Stunt Programmer  &
steve@websentric.com     |  Software Design Engineer