Skip to content

Instantly share code, notes, and snippets.

@s-wool
Created May 9, 2018 09:29
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 s-wool/c8c79347a8dc19b2cbc0b2a6f1b7e940 to your computer and use it in GitHub Desktop.
Save s-wool/c8c79347a8dc19b2cbc0b2a6f1b7e940 to your computer and use it in GitHub Desktop.
guruguru
#!/usr/bin/env perl
use strict;
use warnings;
use Image::Magick;
use Data::Dumper;
my ($filename, $outputname, $size, $span, $delay) = @ARGV;
my $gifanime = Image::Magick->new;
$size = $size . "x" . $size;
my $max = 360 / $span;
for (my $i=0; $i < $max; $i++) {
my $image = Image::Magick->new;
$image->Read("$filename");
$image->Rotate($i*$span);
$image->Extent(geometry=>"$size", background=>"white", gravity=>"center");
$gifanime->[$i] = $image;
$gifanime->[$i]->Set(delay=>$delay);
print $i * $span . "\n";
}
$gifanime->Write("gif:". $outputname);
exit;
@s-wool
Copy link
Author

s-wool commented May 9, 2018

@s-wool
Copy link
Author

s-wool commented May 9, 2018

./guruguru.pl sourcefile.jpg outputfilegif imagesize span delay
./guruguru.pl sourcefile.jpg outputfilegif 128 30 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment