Dependent modules
pip install imageio
Test sample
3
Zhang600×400
black and white1.jpg
picture: ,2.jpg
and3.jpg
Synthetic result
Sample code
import imageio
with imageio.get_writer(uri='test.gif', mode='I', fps=1) as writer:
for i in range(3):
writer.append_data(imageio.imread(f'{i+1}.jpg'))
Parameter Description
uri
:gif
The name of the synthesized GIF can be changed at will.mode
:Operation mode, whichI
means multiple pictures, no need to change.fps
: Frame rate, that is, the number of frames transmitted per second, the larger the value, the greatergif
the playback speed of the animation.
Code explanation
The names of the three pictures are respectively 1.jpg
, 2.jpg
and 3.jpg
, here I use a for
loop to sequentially read and write them into the animation test.gif
file for synthesis.