Image::DeAnim - create static GIF file from animated GIF


   use Image::DeAnim;
   open(G,"animated.gif") or die;
   undef $/;
   $gif = <G>;
   $newgif = Image::DeAnim::gif(\$gif); 
   print $$newgif;

   # Using HTTP::Response

   if ($self -> content_type eq 'image/gif') {
      my $gif = $self -> content;
      $self -> content (${&Image::DeAnim::gif(\$gif)});


Image::DeAnim::gif takes a reference to a scalar conatining a GIF image, and returns a scalar reference to a filtered GIF image. If the input is an animated GIF, the output will be a static GIF of the last frame of the animation. If the input is already a static GIF, the output file should be (mostly) identical.

Image::DeAnim is intended for use with a HTTP proxy server, in order to de-animate GIFs before they reach the browser window.


Currently only outputs last frame. Options for first/other shouldn't be too difficult, though.

If the last image of the animation is not the same size as the first, the remaining image is blacked out (no overlay). It doesn't bother me, but it may for others.

Doesn't work with cached animations, although as images work their way out of the cache, this shouldn't be a problem.

Not very Perl-ish; can probably use lots of fixing, and better documentation. OO in place of references seems to be the next logical step.


Ken MacFarlane, <>


Copyright 1999. This program may be distributed under the Perl Artistic License.