Cuneiform.pm (gscan2pdf-2.13.1.tar.xz) | : | Cuneiform.pm (gscan2pdf-2.13.2.tar.xz) | ||
---|---|---|---|---|
package Gscan2pdf::Cuneiform; | package Gscan2pdf::Cuneiform; | |||
use 5.008005; | use 5.008005; | |||
use strict; | use strict; | |||
use warnings; | use warnings; | |||
use Carp; | use Carp; | |||
use File::Temp; # To create temporary files | use File::Temp; # To create temporary files | |||
use Gscan2pdf::Document; # for slurp | use Gscan2pdf::Document; # for slurp | |||
use version; | use version; | |||
use English qw( -no_match_vars ); # for $PROCESS_ID | use English qw( -no_match_vars ); # for $PROCESS_ID | |||
our $VERSION = '2.13.1'; | our $VERSION = '2.13.2'; | |||
my $SPACE = q{ }; | my $SPACE = q{ }; | |||
my $EMPTY = q{}; | my $EMPTY = q{}; | |||
my ( %languages, $version, $setup, $logger ); | my ( %languages, $version, $setup, $logger ); | |||
# cuneiform language codes | # cuneiform language codes | |||
my %iso639 = ( | my %iso639 = ( | |||
bul => { code => 'bul', name => 'Bulgarian' }, | bul => { code => 'bul', name => 'Bulgarian' }, | |||
ces => { code => 'cze', name => 'Czech' }, | ces => { code => 'cze', name => 'Czech' }, | |||
dan => { code => 'dan', name => 'Danish' }, | dan => { code => 'dan', name => 'Danish' }, | |||
skipping to change at line 118 | skipping to change at line 118 | |||
# Temporary filename for new file | # Temporary filename for new file | |||
$bmp = File::Temp->new( SUFFIX => '.bmp' ); | $bmp = File::Temp->new( SUFFIX => '.bmp' ); | |||
my $image = Image::Magick->new; | my $image = Image::Magick->new; | |||
$image->Read( $options{file} ); | $image->Read( $options{file} ); | |||
my @cmd; | my @cmd; | |||
if ( defined $options{threshold} and $options{threshold} ) { | if ( defined $options{threshold} and $options{threshold} ) { | |||
$logger->info("thresholding at $options{threshold} to $bmp"); | $logger->info("thresholding at $options{threshold} to $bmp"); | |||
@cmd = ( | @cmd = ( | |||
'convert', $options{file}, '+dither', '-threshold', | 'convert', $options{file}, '+dither', '-threshold', | |||
"$options{threshold}%", '-depth', 1, $bmp, | "$options{threshold}%", '-depth', 1, $bmp, | |||
); | ); | |||
} | } | |||
else { | else { | |||
$logger->info("writing temporary image $bmp"); | $logger->info("writing temporary image $bmp"); | |||
# Force TrueColor, as this produces DirectClass, which is what cuneiform expects . | # Force TrueColor, as this produces DirectClass, which is what cuneiform expects . | |||
# Without this, PseudoClass is often produced, for which cuneiform gives | # Without this, PseudoClass is often produced, for which cuneiform gives | |||
# "PUMA_XFinalrecognition failed" warnings | # "PUMA_XFinalrecognition failed" warnings | |||
@cmd = ( 'convert', $options{file}, '-type', 'truecolor', $bmp, ); | @cmd = ( 'convert', $options{file}, '-type', 'truecolor', $bmp, ); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added |