Why is my gif missing png files after 753 iteratio

2019-08-18 23:55发布

问题:

I'm using the following python code to generate a .gif file from about 3000 .png files. But the .gif file has only about 1000 .png files. Why is the .gif not having all the .png files? Is there a limit to the number of .png files I can combine to create a .gif file?

import imageio
import os

filenames =[]
dirPath = "D:\\BandSim_2017-06-20_12_00_45\\"
for file in os.listdir(dirPath):
     if file.endswith(".png"):
         filenames.append(dirPath+file)
moviePath ="D:\\simulation.gif"
with imageio.get_writer(moviePath,mode='I', duration=0.1) as writer:
i=0
for filename in filenames:
    image = imageio.imread(filename)
    writer.append_data(image)
    print filename