0

我正在使用以下 python 代码从大约 3000 个 .png 文件中生成一个 .gif 文件。但是 .gif 文件只有大约 1000 个 .png 文件。为什么 .gif 没有所有 .png 文件?我可以组合创建 .gif 文件的 .png 文件的数量是否有限制?

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
4

0 回答 0