Search code examples
pnggifanimated-gif

Can I separate a Gif in each image is conformed?


I was wondering if there is any tool or if there is any way in order to take from a gif file, and save a file for each image.

This way I can get each frame separated in a file.


Solution

  • Using python

    A script made in python is available here:

    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')
    

    ban_ccccccccccc.gif is the name of your GIF image, and output the name of the folder were the frames will be saved.