how to make previous snapshots of a gif transparent in python

Viewed 12

I am making a gif using figures in python. At the moment my code disappears previous snapshots. I have three figures to make the gif. The following is my code:

import imageio
files = [f'fig_{i}.jpg' for i in range(1,4)]
images = []
for name in files:
    images.append(imageio.imread(name))
imageio.mimsave('output_gif.gif', images, 'GIF', duration = 1)

This code gives the following gif:

enter image description here

But I want to see previous figures in each snapshot but a figure with alpha = 0.5. I mean the first snapshot should show the first figure, then in the next one the new figure pops up while the old one gets transpare. An in the last snapshot first two figure should be transparent while the new coming is poping up.

These are also three figures I used for making the gif:

enter image description here

enter image description here

enter image description here

I very much appreciate your help.

0 Answers
Related