从图像文件夹创建GIF

时间:2019-06-24 16:51:03

标签: python-3.x gif python-imageio

我想从一个充满序列图像的文件夹中创建一个GIF。

我找到了这个线程,但是无法正常工作: Programmatically generate video or animated GIF in Python?

到目前为止,这是我的代码:

import imageio
import os

imglist = []
images = []
path = 'C:/Users/Artur/Desktop/images/'
for r, _, f in os.walk(path):
    for i in f:
        imglist.append(r + i)

for filename in imglist:
    images.append(imageio.imread(filename))

imageio.mimsave(path + 'gif.gif', images)

引发错误:

Traceback (most recent call last):
  File "C:/Users/Artur/Desktop/gifmaker.py", line 12, in <module>
    images.append(imageio.imread(filename))
  File "C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\site-packages\imageio\core\functions.py", line 221, in imread
    reader = read(uri, format, "i", **kwargs)
  File "C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\site-packages\imageio\core\functions.py", line 139, in get_reader
    "Could not find a format to read the specified file " "in mode %r" % mode
ValueError: Could not find a format to read the specified file in mode 'i'

这是我的图像文件夹: images.rar

0 个答案:

没有答案