Last active
April 13, 2019 06:02
-
-
Save kwcooper/3764e504a96bebe266d12b2953981c4c to your computer and use it in GitHub Desktop.
Takes images from a directory and builds a movie from them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make a movie from images | |
import glob | |
import imageio | |
import os | |
path_name = "img/*.png" | |
# grab files, sorted by modification time | |
#filenames = glob.glob("img/*.png") | |
filenames = sorted(glob.glob(path_name), key=os.path.getmtime) | |
# compile frames into imageio objects | |
print('Making movie, may take a sec...') | |
images = [] | |
for filename in filenames: | |
images.append(imageio.imread(filename)) | |
# save that bad boy | |
imageio.mimsave('movie.gif', images) | |
print('fin') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment