#!/usr/bin/perl
use GD;
use GD::Image;
use GD::Image::AnimatedGif;
use Getopt::Long;

my $ms = 15;
my $trans = 0;
Getopt::Long::Configure ("bundling");
$result = GetOptions("ms=i" => \$ms, "trans|t"   => \$trans);
                                                                                         

if(!@ARGV) {die;}

my $image = GD::Image->newFromPng($ARGV[0]);
my $image = GD::Image->new($image->getBounds);

print $image->gifanimbegin(0,0);

for my $f (@ARGV) {
	my $frame  = GD::Image->newFromPng($f);
	if($trans)
		{$frame->transparent(0)};
	print $frame->gifanimadd(1,0,0,$ms,2);
}
print $image->gifanimend;
