Making a GIF animation using imageio - Python

Python code to merge images from a specified folder into a gif animation.

Change the "duration" parameter to change the animation FPS.

import imageio
import os
in_path = "C:/in_folder/"

out_filename="animation"
out_path="C:/out_folder/"

in_filenames = os.listdir(path)

with imageio.get_writer(out_path+out_filename+".gif", mode='I', duration='0.25') as writer:
    for in_filename in in_filenames:
        print(in_path+in_filename)
        image = imageio.imread(in_path + in_filename)
        writer.append_data(image)