Skip to content

Instantly share code, notes, and snippets.

@cincodenada
Created February 11, 2016 04:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cincodenada/3a559df6e5e41147ad1d to your computer and use it in GitHub Desktop.
Save cincodenada/3a559df6e5e41147ad1d to your computer and use it in GitHub Desktop.
Gifsicle Speed Changer
use POSIX;
if($#ARGV == -1) { die "No speedup value specified!"; }
$speedup = shift(@ARGV);
while(<>) {
if(/\+ image #(\d+)/) {
$num = $1;
} elsif(/delay ([\d\.]+)s/) {
$delay = POSIX::strtod($1);
$delay /= $speedup;
if($lastdelay && $lastdelay != $delay) {
if(!$startnum) { $startnum = 0; }
printf("-d%d #%d-%d ",POSIX::ceil($delay*10), $startnum, $num-1);
$startnum = $num;
}
$lastdelay = $delay;
}
}
SPEEDUP=$1
INGIF=$2
OUTGIF=$3
gifsicle `gifsicle --info $INGIF | perl delayspec.pl $SPEEDUP` < $INGIF > $OUTGIF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment