欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python:GIF

程序员文章站 2022-03-24 19:36:10
...
import  imageio
import  os

def create_gif(image_list,gif_name):
    frames=[]
    for image_name in  image_list:
        frames.append(imageio.imread(image_name))
    imageio.mimsave(gif_name,frames,"GIF",duration=0.8)

def make(path,gif_name):
    image_list=[]
    for i in os.listdir(path):
        if i.endswith(".jpg"):
            image_list.append(os.path.join(path,i))
    create_gif(image_list,gif_name)

if __name__=='__main__':
	# 图片文件夹路径
    path = "F:\\图片\\test"
    gif_name = "2017.gif"
    make(path,gif_name)





相关标签: gif