I am making a gif by imageio
module using generated .png files. Although the .png files are sorted and in an order of numbers, the generated .gif animation does not follow this order. What is the reason?
Here is my code so far:
png_dir='png'
images=[]
for file_name in os.listdir(png_dir):
if file_name.endswith('.png'):
file_path = os.path.join(png_dir, file_name)
images.append(imageio.imread(file_path))
imageio.mimsave('movie.gif', images, duration=1)
and the .png files are like file_01.png, file_02.png ... file_099.png
Why the gif is not generated with the same order of the .png files?
Thanks in advance for any help!