Skip to main content
Link to copy of images2gif since original link is down
Source Link

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.pyimages2gif.py (formerly images2gif.py, update courtesy of @geographika).

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse()

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py (formerly images2gif.py, update courtesy of @geographika).

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse()

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py (formerly images2gif.py, update courtesy of @geographika).

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse()

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)
updated images2gif.py link
Source Link
kostmo
  • 6.3k
  • 4
  • 41
  • 52

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py (formerly images2gif.py, update courtesy of @geographika).

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse()

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py.

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse()

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py (formerly images2gif.py, update courtesy of @geographika).

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse()

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)
simplified/improved code
Source Link
kostmo
  • 6.3k
  • 4
  • 41
  • 52

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py.

For instanceThen, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open("frog.gif"filename)
original_duration = im.info['duration']
index = 1
frames = []
[frame.copy() for frame in ImageSequence.Iterator(im):
#   frame.save("frame%d.png" % index)
    frames.append( frame.copy() )
  ]  index += 1

frames.reverse() 

from images2gif import writeGif
writeGif("reverse_frog"reverse_" + os.gif"path.basename(filename), frames, duration=original_duration/1000.0, dither=0)

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py.

For instance, to reverse the frames in a gif:

#!/usr/bin/env python

from PIL import Image, ImageSequence

im = Image.open("frog.gif")
original_duration = im.info['duration']
index = 1
frames = []
for frame in ImageSequence.Iterator(im):
#   frame.save("frame%d.png" % index)
    frames.append( frame.copy() )
    index += 1

frames.reverse()
from images2gif import writeGif
writeGif("reverse_frog.gif", frames, duration=original_duration/1000.0, dither=0)

As of June 2009 the originally cited blog post has a method to create animated GIFs in the comments. Download the script images2gif.py.

Then, to reverse the frames in a gif, for instance:

#!/usr/bin/env python

from PIL import Image, ImageSequence
import sys, os
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]    
frames.reverse() 

from images2gif import writeGif
writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)
Source Link
kostmo
  • 6.3k
  • 4
  • 41
  • 52
Loading