Skip to content

Instantly share code, notes, and snippets.

@cheekybastard
Forked from revolunet/extractGifs.py
Created February 20, 2013 12:47
Show Gist options
  • Save cheekybastard/4995303 to your computer and use it in GitHub Desktop.
Save cheekybastard/4995303 to your computer and use it in GitHub Desktop.
import os
from PIL import Image
def extractFrames(inGif, outFolder):
frame = Image.open(inGif)
nframes = 0
while frame:
frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF')
nframes += 1
try:
frame.seek( nframes )
except EOFError:
break;
return True
extractFrames('ban_ccccccccccc.gif', 'output')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment