Skip to content

Instantly share code, notes, and snippets.

@koyachi
Created August 3, 2008 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koyachi/3804 to your computer and use it in GitHub Desktop.
Save koyachi/3804 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Imager;
die "Usage: div_animgif.pl filename\n" if !-f $ARGV[0];
my $file = shift;
my @imgs = Imager->read_multi(file => $file, type=>"gif")
or die "Cannot read: ", Imager->errstr;
for (my $i = 0; $i < scalar(@imgs); $i++) {
my $img = $imgs[$i];
my $out_filename = sprintf "%s_%03d.png", $file, $i;
$img->write(file=> $out_filename, type=>"png")
or die "Cannot write: ", $img->errstr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment