save animated GIF in Python Image Library

Fredrik Lundh fredrik at pythonware.com
Tue Feb 24 17:34:22 EST 2004


"christof hoeke" <csad7 at yahoo.com> wrote:

> how can i save an animated GIF with PIL?
>
> e.g. to rotate all frames of an image i tried the following:
>
> im = Image.open('anim.gif')
> for f in ImageSequence(im): #using the class from the PIL handbook
>      if f:
>          f = f.rotate(180)
> im.save('animrotated.gif')
>
> problem is that only one frame (i guess the last one) is saved.
> i could not find any options for saving GIFs in the handbook.
>
> can this be done at all?

see the "gifmaker" example in the Scripts directory.

(get the PIL source distribution if you don't have it)

</F>







More information about the Python-list mailing list