Changeset 9
- Timestamp:
- 25.10.2006 16:32:36 (2 years ago)
- Files:
-
- trunk/devel/FuzzyOcr.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/devel/FuzzyOcr.pm
r8 r9 379 379 380 380 my $retcode = $t->run_and_catch(sub { 381 @stdout_data = qx($App{gifsicle} --info $giffile);381 @stdout_data = qx($App{gifsicle} --info $giffile); 382 382 }); 383 383 384 384 if ($retcode) { 385 #FIXME: WARN HERE385 #FIXME: WARN HERE 386 386 } 387 387 … … 408 408 (?: .* \b delay \s+ (\d+(?:\.\d+)?) s)? 409 409 }sx; 410 #FIXME: Handle this error410 #FIXME: Handle this error 411 411 $n == $frameno 412 or warn ( "Trouble parsing 'gifsicle --info' output."413 . " Expected 'image \#$frameno', found 'image \#$n' \n" );412 or debuglog ( "Trouble parsing 'gifsicle --info' output.\n" 413 . " Expected 'image \#$frameno', found 'image \#$n'" ); 414 414 415 415 $info{'delays'}->[$frameno++] = $delay ? $delay + 0.0 : 0.0; … … 848 848 } 849 849 } 850 if ($interlaced_gif or ($image_count gt1)) {850 if ($interlaced_gif or ($image_count > 1)) { 851 851 debuglog("Image is interlaced or animated..."); 852 852 } … … 877 877 878 878 if ($corrupt) { 879 if ($interlaced_gif or ($image_count gt1)) {879 if ($interlaced_gif or ($image_count > 1)) { 880 880 debuglog("Skipping corrupted interlaced image..."); 881 881 corrupt_img($Score{corrupt_unfixable}, $corrupt); … … 891 891 } 892 892 893 if ($image_count gt1) {893 if ($image_count > 1) { 894 894 debuglog("File contains <$image_count> images, deanimating..."); 895 my $tfile2 = $tfile;896 my $tfile3 = $tfile;895 my $tfile2 = $tfile; 896 my $tfile3 = $tfile; 897 897 898 898 if ($tfile2 =~ m/\.gif$/i) { 899 899 $tfile2 =~ s/\.gif$/-multi.gif/i; 900 $tfile3 =~ s/\.gif$/-reduced.gif/i;900 $tfile3 =~ s/\.gif$/-reduced.gif/i; 901 901 } else { 902 902 $tfile2 .= ".gif"; 903 $tfile3 .= "-reduced.gif";904 } 905 906 my $info = gif_info($tfile, $t);907 my $index = find_dominant_image($info);908 909 # Pick frame number $index from the animation and spew to stdout:910 if ($info->{'has_local_color_table'}) {911 # FIXME: Check retcodes912 $retcode = $t->run_and_catch(sub {913 qx($App{gifsicle} --colors=255 $tfile >$tfile3 2>>$efile);914 });915 $retcode = $t->run_and_catch(sub {916 qx($App{gifsicle} --unoptimize $tfile3 \'#$index\' >$tfile2 2>>$efile);917 });918 } else {919 $retcode = $t->run_and_catch(sub {920 qx($App{gifsicle} --unoptimize $tfile \'#$index\' >$tfile2 2>>$efile);921 });922 }923 $tfile = $tfile2;903 $tfile3 .= "-reduced.gif"; 904 } 905 906 my $info = gif_info($tfile, $t); 907 my $index = find_dominant_image($info); 908 909 # Pick frame number $index from the animation and spew to stdout: 910 if ($info->{'has_local_color_table'}) { 911 # FIXME: Check retcodes 912 $retcode = $t->run_and_catch(sub { 913 qx($App{gifsicle} --colors=255 $tfile >$tfile3 2>>$efile); 914 }); 915 $retcode = $t->run_and_catch(sub { 916 qx($App{gifsicle} --unoptimize $tfile3 \'#$index\' >$tfile2 2>>$efile); 917 }); 918 } else { 919 $retcode = $t->run_and_catch(sub { 920 qx($App{gifsicle} --unoptimize $tfile \'#$index\' >$tfile2 2>>$efile); 921 }); 922 } 923 $tfile = $tfile2; 924 924 } 925 925 … … 1189 1189 1190 1190 1; 1191 #vim: et ts=4 sw=4
