Manipulating GIF image frames w/ PIL - where'd my palette go?

skip at pobox.com skip at pobox.com
Mon Sep 4 18:07:28 CEST 2006


I'm unclear how PIL handles multi-frame GIF images.  I have such a GIF image
in a file, bogus.gif.  I can view the individual frames like so
(ImageSequence is from the PIL tutorial):

    >>> img = Image.open("bogus.gif")
    >>> for frame in ImageSequence(img):
    ...   frame.show()

All but the first image appears black-and-white.  They apparently lose the
color palette associated with the overall image.  The palette for the
original image and the individual frames is the same, the histograms suggest
they have more than two colors and both the image the frames have mode 'P'.
What have I missed?

Thx,

Skip




More information about the Python-list mailing list