您好,登录后才能下订单哦!
将gif分解成单个图片
import os
from PIL import Image,ImageSequence
gif = Image.open(r'LDY00.gif')
if os.path.exists("output1") == False:
os.mkdir("output1")
for i,frame in enumerate(ImageSequence.Iterator(gif),1):
frame.save(r'output1/%d.png'%i)
将单张图片合成gif,
import imageio
def create_gif(path, gif_name, duration):
frames = []
image_list = []
for i in range(1,60):
image_list.append(path+"/%d.png" % i)
for image_name in image_list:
frames.append(imageio.imread(image_name))
imageio.mimsave(gif_name, frames, 'GIF', duration=duration)
return郑州中原妇科医院 http://mobile.chfk120.com/
def main():
#image_list = ['output1/1.png', 'output1/2.png', 'output1/3.png']
path=r'output1'
gif_name = 'output1/Dec02.gif'
duration = 2
create_gif(path, gif_name, duration)
if __name__ == '__main__':
main()
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。