Skip to content

Instantly share code, notes, and snippets.

@syohex
Created August 8, 2012 00:41
Show Gist options
  • Save syohex/3290966 to your computer and use it in GitHub Desktop.
Save syohex/3290966 to your computer and use it in GitHub Desktop.
Extract gif and convert these frame into png
#!perl
use strict;
use warnings;
use Imager;
my $input = shift or die "Usage: $0 inputfile";
my $imager = Imager->new;
my @imgs = $imager->read_multi(file => $input) or $imager->errstr;
my $i = 1;
for my $img (@imgs) {
my $output = sprintf "%d.png", $i++;
$img->write(file => $output, type => 'png') or die $img->errstr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment