save animated GIF in Python Image Library

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • christof hoeke

    save animated GIF in Python Image Library

    hi,
    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('ani m.gif')
    for f in ImageSequence(i m): #using the class from the PIL handbook
    if f:
    f = f.rotate(180)
    im.save('animro tated.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?

    thanks
    christof

  • Fredrik Lundh

    #2
    Re: save animated GIF in Python Image Library

    "christof hoeke" <csad7@yahoo.co m> wrote:
    [color=blue]
    > 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('ani m.gif')
    > for f in ImageSequence(i m): #using the class from the PIL handbook
    > if f:
    > f = f.rotate(180)
    > im.save('animro tated.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?[/color]

    see the "gifmaker" example in the Scripts directory.

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

    </F>




    Comment

    Working...