Last active
April 6, 2017 02:13
-
-
Save dguzzo/cecc2ef8b8b520af3dc40e209eadc183 to your computer and use it in GitHub Desktop.
make an animated gif from some images with Wand
This file contains hidden or 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
#!/usr/bin/env python3 | |
from glob import glob | |
from wand.image import Image | |
source_images = glob("S*.png") | |
TOTAL_FRAMES = len(source_images) | |
print("animating %i files" % TOTAL_FRAMES ) | |
with Image() as animation: | |
# Add new frames into sequance | |
for path in source_images: | |
with Image(filename=path) as new_frame: | |
new_frame.delay = 20 | |
animation.sequence.append(new_frame) | |
# Set layer type | |
animation.type = 'optimize' | |
print("saving animation...") | |
animation.save(filename='animated-python.gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not flexible at all at the moment! for instance, the
glob()
parameter is hardcoded.