Changeset 13

Show
Ignore:
Timestamp:
25.10.2006 20:05:23 (2 years ago)
Author:
jorge
Message:

Removed Image::Magick dependency

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr.pm

    r12 r13  
    1515 
    1616use String::Approx 'adistr'; 
    17 use Image::Magick; 
     17#use Image::Magick; 
    1818use MLDBM qw(DB_File Storable); 
    1919use FileHandle; 
     
    3232 
    3333our @bin_utils = qw/gifsicle giffix giftext gifinter giftopnm  
    34     jpegtopnm pngtopnm bmptopnm tifftopnm ppmhist gocr ocrad/; 
     34    jpegtopnm pngtopnm bmptopnm tifftopnm ppmhist pamfile gocr ocrad/; 
    3535 
    3636our @pgm_scores = qw/base add corrupt corrupt_unfixable wrongctype 
     
    379379 
    380380    my $retcode = $t->run_and_catch(sub { 
    381             @stdout_data = qx($App{gifsicle} --info $giffile); 
     381        @stdout_data = qx($App{gifsicle} --info $giffile); 
    382382    }); 
    383383 
     
    575575    my ($rcode, $hash); 
    576576 
    577     foreach my $a (qw/ppmhist/) { 
     577    foreach my $a (qw/pamfile ppmhist/) { 
    578578        unless (defined $App{$a}) { 
    579579            info("FuzzyOcr: calc_image_hash cannot exec $a"); 
     
    586586        return(1,''); 
    587587    } 
    588     my $img = new Image::Magick; 
     588 
     589    my @stdout_data; 
    589590    my ($w,$h,$s,$t) = (0,0,0,0); 
    590     ($w,$h,$s,$t) = $img->ping($pfile); 
    591  
    592591    $t = Mail::SpamAssassin::Timeout->new({ secs => $Option{timeout} }); 
    593     my @stdout_data; 
     592    $rcode = $t->run_and_catch(sub { 
     593        @stdout_data = qx($App{pamfile} $pfile 2>/dev/null); 
     594    }); 
     595    if ($rcode) { 
     596        chomp $rcode; 
     597        debuglog("$App{pamfile}: Timed out [$rcode], skipping..."); 
     598        return (1, ''); 
     599    } 
     600    if ($stdout_data[0] =~ m/(\d+) by (\d+)/) { 
     601        $w = $1; $h = $2; 
     602        $s = (stat($pfile))[7]; 
     603    } 
     604 
    594605    $rcode = $t->run_and_catch(sub { 
    595606        @stdout_data = qx($App{ppmhist} -noheader $pfile 2>/dev/null); 
     
    10331044            } 
    10341045 
    1035            printf RAWERR qq(## $App{tifftopnm} $file >$pfile 2>>$efile\n) if ($haserr>0); 
     1046            printf RAWERR qq(## $App{tifftopnm} $file >$pfile 2>>$efile\n) if ($haserr>0); 
    10361047            $retcode = $t->run_and_catch(sub { 
    10371048                qx($App{tifftopnm} $file >$pfile 2>>$efile); 
  • trunk/devel/INSTALL

    r11 r13  
    99  gifsicle: 
    1010    http://www.lcdf.org/gifsicle/gifsicle-1.44.tar.gz (latest) 
    11  
    12   ImageMagic: 
    13     http://www.imagemagick.org/script/binary-releases.php 
    14     ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz 
    15  
    16   PerlMagic: 
    17     http://www.imagemagick.org/script/download.php 
    1811 
    1912  gocr: (v0.40) suggested ... needs to be patched!