Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image, ImageSequence
- import os
- org_gif = 'flag.gif'
- dic = 'image'
- img = Image.open(org_gif)
- frames = (frame.copy() for frame in ImageSequence.Iterator(img))
- if not os.path.isdir(dic):
- os.mkdir(dic)
- for i, f in enumerate(frames):
- name = '{}/{}.png'.format(dic, i+1)
- f.save(name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement