HI, I'm back after a while, so I want to share some little nice code (useful, if it's possible). I keep loving Python and keep using it on a daily routine and, if I got time, I want to come back here to share some cool stuff with the world wide web.
So, I searched for some method to make gifs with Python and I found this code. You have to put all the images in a directory. Write this code, save it in the directory and let it run. You can use any program to make the images. I used powrpoint, then I saved each slide as a png and then I run the program. I had also to change the name of the slides to make them in the right order, but I will talk about this in the next post.
Here is the code
So, I searched for some method to make gifs with Python and I found this code. You have to put all the images in a directory. Write this code, save it in the directory and let it run. You can use any program to make the images. I used powrpoint, then I saved each slide as a png and then I run the program. I had also to change the name of the slides to make them in the right order, but I will talk about this in the next post.
Here is the code
import subprocess
import os
def mk(i, o, delay=100):
subprocess.call("convert -delay " +
delay + " -loop 5 " + i + " " + o, shell=True)
delay = input("Delay (default 100): ")
mk("*.png", "output.gif", delay)
os.system("start output.gif")
Comments
Post a Comment