您好,登錄后才能下訂單哦!
將gif分解成單個(gè)圖片
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鄭州中原婦科醫(yī)院 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()
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。