I'm using imageio
to generate a GIF from a set of PNGs that I've created using PIL. Here's my code (found here):
import imageio
path = "./img/"
os.chdir(path)
filenames = sorted((fn for fn in os.listdir('.') if fn.endswith('.png')))
with imageio.get_writer('./img/movie.gif', mode='I') as writer:
for filename in filenames:
image = imageio.mimread(filename)
writer.append_data(image)
However, I keep getting the following error:
Traceback (most recent call last):
File "gifcreate.py", line 7, in <module>
image = imageio.mimread(filename)
File "/Users/felipe_campos/Documents/DECO/venv/lib/python2.7/site-packages/imageio/core/functions.py", line 261, in mimread
reader = read(uri, format, 'I', **kwargs)
File "/Users/felipe_campos/Documents/DECO/venv/lib/python2.7/site-packages/imageio/core/functions.py", line 108, in get_reader
'in mode %r' % mode)
ValueError: Could not find a format to read the specified file in mode 'I'
Does anybody have any ideas as to what I can do? I tried running it outside the virtual environment but it keeps telling me ImportError: No module named imageio
(same with scipy and a few other modules), so I'm at a loss for what to do.
EDIT:
Figured it out, just use imread(filename) instead of mimread(filename) and it worked fine.