| 372 | | sub deanim { |
|---|
| 373 | | my ($infile, $outfile, $errfile) = @_; |
|---|
| 374 | | my $info = gif_info($infile); |
|---|
| 375 | | my $index = find_dominant_image($info); |
|---|
| 376 | | |
|---|
| 377 | | # Pick frame number $index from the animation and spew to stdout: |
|---|
| 378 | | if ($info->{'has_local_color_table'}) { |
|---|
| 379 | | # FIXME: Check retcodes and adjust filenames |
|---|
| 380 | | my $infile2 = $infile . "-reduced"; |
|---|
| 381 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 382 | | qx($App{gifsicle} --colors=255 $infile >$infile2 2>>$errfile); |
|---|
| 383 | | }); |
|---|
| 384 | | |
|---|
| 385 | | $retcode = $t->run_and_catch(sub { |
|---|
| 386 | | qx($App{gifsicle} --unoptimize #$index $infile2 >$outfile 2>>$errfile); |
|---|
| 387 | | }); |
|---|
| 388 | | } |
|---|
| 389 | | |
|---|
| 390 | | else { |
|---|
| 391 | | my $retcode = $t->run_and_catch(sub { |
|---|
| 392 | | qx($App{gifsicle} --unoptimize #$index $infile2 >$outfile 2>>$errfile); |
|---|
| 393 | | }); |
|---|
| 394 | | } |
|---|
| 395 | | |
|---|
| 396 | | } |
|---|
| 397 | | |
|---|
| 398 | | sub gif_info ($) { |
|---|
| 399 | | my ($giffile) = @_; |
|---|
| | 372 | sub gif_info { |
|---|
| | 373 | my ($giffile, $t) = @_; |
|---|
| 933 | | } |
|---|
| 934 | | |
|---|
| 935 | | deanimate($tfile, $tfile2, $efile) |
|---|
| | 904 | $tfile3 .= "-reduced.gif"; |
|---|
| | 905 | } |
|---|
| | 906 | |
|---|
| | 907 | my $info = gif_info($tfile, $t); |
|---|
| | 908 | my $index = find_dominant_image($info); |
|---|
| | 909 | |
|---|
| | 910 | # Pick frame number $index from the animation and spew to stdout: |
|---|
| | 911 | if ($info->{'has_local_color_table'}) { |
|---|
| | 912 | # FIXME: Check retcodes |
|---|
| | 913 | $retcode = $t->run_and_catch(sub { |
|---|
| | 914 | qx($App{gifsicle} --colors=255 $tfile >$tfile3 2>>$efile); |
|---|
| | 915 | }); |
|---|
| | 916 | print "blah1\n"; |
|---|
| | 917 | $retcode = $t->run_and_catch(sub { |
|---|
| | 918 | qx($App{gifsicle} --unoptimize $tfile3 \'#$index\' >$tfile2 2>>$efile); |
|---|
| | 919 | }); |
|---|
| | 920 | |
|---|
| | 921 | print "blah2\n"; |
|---|
| | 922 | } else { |
|---|
| | 923 | $retcode = $t->run_and_catch(sub { |
|---|
| | 924 | qx($App{gifsicle} --unoptimize $tfile \'#$index\' >$tfile2 2>>$efile); |
|---|
| | 925 | }); |
|---|
| | 926 | } |
|---|