GIFs are images that can be animated, i.e. consist of a sequence of frames. There are two types of GIFs in the world: Type A stores each frame separately, and type B instead stores the differences between subsequent GIFs.
I am loading GIFs using imageio
which works fine for type A but only returns differences for type B. How can I easily get the full frames instead?
This is how I get the images:
reader = imageio.get_reader(filename)
for _ in range(reader.get_length()):
PIL.Image.fromarray(reader.get_next_data().copy()).convert('RGBA')
And this is the result when I use a GIF of type A (left, good) versus type B (right, bad) for my hug-an-image algorithm:
Inputs: