[Image-SIG] Retrieve a GIF's palette entries using Python Imaging Library (PIL)

Terry Carroll carroll at tjc.com
Fri Jan 13 23:30:42 CET 2006


On Fri, 13 Jan 2006, Stuart White wrote:

> I am using the Python Imaging Library (PIL) to process GIF images. I
> need to be able to retrieve the RGB values for each color palette entry.
> 
> I see that the 'Image' class has a 'palette' attribute which returns an
> object of type 'ImagePalette'.  However, the documentation is a bit
> lacking regarding how to maniuplate the ImagePalette class to retrieve
> the palette entries' RGB values.  Can anyone point me to a short example?

There was a very helpful discussion on this topic on Python-tutor last 
summer.  Check out the thread "PIL's palette" at this URL:

http://mail.python.org/pipermail/tutor/2005-July/thread.html#39719



More information about the Image-SIG mailing list