# -*- coding: UTF-8 -*- # encoding: utf-8 #-*- coding: UTF-8 -*- # 版权所有 2023 ©涂聚文有限公司 # 许可信息查看: # 描述: # Author : geovindu,Geovin Du 涂聚文. # IDE : PyCharm 2023.1 python 11 # Datetime : 2023/7/5 11:08 # User : geovindu # Product : UI # Project : pythonTkinterDemo # File : menu.py # explain : 学习 from PIL import Image,ImageSequence import glob def makeGif(framefolder): """ 生成GIF动画图片 :param framefolder: 文件夹 :return: """ images = glob.glob(f"{framefolder}/*.png") images.sort() frames = [Image.open(image) for image in images] frame_one = frames[0] print(frame_one) frame_one.save(framefolder+"/geovindu.gif", format="gif", append_images=frames, save_all=True, duration=50, loop=0)
调用:
pathfolder = 'img_seq' makeGif(pathfolder) img=Image.open(pathfolder+"\geovindu.gif") img.save()
标签:img,gif,python,create,framefolder,frames,geovindu,GIF,images From: https://www.cnblogs.com/geovindu/p/17537267.html