Skip to content

Extract frames from animated gif, every frame is not correct except the first frame when I save it to png file #1692

@cflyt

Description

@cflyt

I want to extract frames from an animated gif image, and save every frame into png format, but i found the png is not correct in some area except the first frame.

   im = Image.open('earth.gif')
   try:
        while True:
            new_frame = im.convert('RGBA')
            new_frame.save('foo%02d.png' % im.tell(), 'PNG')
            im.seek(im.tell()+1)
    except EOFError:
        pass

This is origin image
earth.gif
earth

This is the second frame which i use my program got.
foo01

And the second frame shoud be(correct one):
image

the different area(red mark) between them:
diff

other frames has the same problem, is it a bug in GifImagePlugin.py?
Tell me what i should do ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions