#5 In convert_to_tiff function.

closed
nobody
None
5
2007-10-17
2007-10-17
Yongjin Cho
No

sub convert_to_tiff {
my ($filename) = @_;
my $image = Image::Magick->new;
my $x = $image->Read($filename);
warn "$x" if "$x";

# Calculate the resolution
my $height = $image->Get('height');
my $width = $image->Get('width');
my $ratio = $height/$width;
$ratio = 1/$ratio if ($ratio < 1);
my $density = 72;
for (my $i = 0; $i <= $#paperg; ++$i) {
if ($xg[$i] > 0 and abs($ratio - $yg[$i]/$xg[$i]) < 0.01) {
$density = (($height > $width) ? $height : $width)/$yg[$i]*25.4;
}
}

I think that a variable $i of 'for' loop is set from 0 to 3. So I changed it to following.

for (my $i = 0; $i < $#paperg; ++$i) {

Before this changing I can not open my BMP file. But the problem disappears after the modification.

Discussion

  • Logged In: YES
    user_id=1191635
    Originator: NO

    Thanks for the patch. Would you mind posting the BMP so that I can test, please?

     
  • Yongjin Cho
    Yongjin Cho
    2007-10-17

    my BMP file

     
    Attachments
  • Yongjin Cho
    Yongjin Cho
    2007-10-17

    Logged In: YES
    user_id=1915028
    Originator: YES

    Thanks for your note.

    When I open the attached BMP file, gscan2pdf reports an error message like following.

    *** unhandled exception in callback:
    *** Illegal division by zero at /usr/bin/gscan2pdf line 1130.
    *** ignoring at /usr/bin/gscan2pdf line 724.

    I am using gscan2pdf 0.9.13 in Ubuntu Gutsy.
    File Added: aho-01.bmp.zip

     
  • Logged In: YES
    user_id=1191635
    Originator: NO

    Your BMP opens without error with the latest version of gscan2pdf without patch. 0.9.13 is quite old. Might I suggest you update to 0.9.17 from the website?

     
    • status: open --> closed
     
  • Logged In: YES
    user_id=1191635
    Originator: NO

    If you are still having problems after updating, I'll look at the problem again.

    Thanks for the feedback.

     
  • Yongjin Cho
    Yongjin Cho
    2007-10-17

    Logged In: YES
    user_id=1915028
    Originator: YES

    The problem doesn't occur after updating.

    Thanks for your help.

     
  • Yongjin Cho
    Yongjin Cho
    2007-10-17

    • status: closed --> open
     
    • status: open --> closed