PerlMagick causes fatal errors for Perl

P

PB

I am using PerlMagick to automate image resizing and resampling. The
problem is that every time I try to use one of the Image::Magick
functions, Perl crashes. Here is an example of the code I am trying to
run:

use Image::Magick;

$image = Image::Magick->new;

open( INFILE, "c:/dir/source-file.jpg" ) or die "Could not open the
file: $!\n";
$image->Read( file=>\*INFILE );
close INFILE;

$image->resize( geometry=>'288x384', support=>'.1' );

open( OUTFILE, ">output-file.jpg" );
$image->Write(file=>\*OUTFILE, filename=>'output-file.jpg');
close( OUTFILE );
undef $image;

__END__

When run, this code causes a "Perl Command Line Interpreter has
encountered a problem and needs to close" window and Windows XP wants
to send an error report to MS. I can see in the dump linked from this
window that there are errors right down to the kernel, so I suspect
that this is an issue with my installation of ImageMagick (I am using
the binary ImageMagick-6.2.5-5-Q16-windows-dll on Windows XP Pro), or
Perl (ActivePerl 5.8.7 Build 813). If that is the case, my post here is
simply to see if anyone else has had/knows of this problem.

Any help is greatly appreaciated.
 
J

J. Gleixner

PB said:
I am using PerlMagick to automate image resizing and resampling. The
problem is that every time I try to use one of the Image::Magick
functions, Perl crashes. Here is an example of the code I am trying to
run:

use Image::Magick;

$image = Image::Magick->new;

open( INFILE, "c:/dir/source-file.jpg" ) or die "Could not open the
file: $!\n";
$image->Read( file=>\*INFILE );
close INFILE;

$image->resize( geometry=>'288x384', support=>'.1' );

open( OUTFILE, ">output-file.jpg" );
$image->Write(file=>\*OUTFILE, filename=>'output-file.jpg');
close( OUTFILE );
undef $image;

__END__

When run, this code causes a "Perl Command Line Interpreter has
encountered a problem and needs to close" window and Windows XP wants
to send an error report to MS. I can see in the dump linked from this
window that there are errors right down to the kernel, so I suspect
that this is an issue with my installation of ImageMagick (I am using
the binary ImageMagick-6.2.5-5-Q16-windows-dll on Windows XP Pro), or
Perl (ActivePerl 5.8.7 Build 813). If that is the case, my post here is
simply to see if anyone else has had/knows of this problem.

You installed PerlMagick, right? Did the "make test" succeed?
Any help is greatly appreaciated.

Nope, however you could try adding some error checking to ensure the
methods, especially the open(), were successful, or going through it
with the debugger "perl -d", to see which line is failing.

I'd do away with opening a file handle, and just pass the file name to
the Read or Write method, much easier to code and maintain.
 
P

PB

J. Gleixner said:
Did the "make test" succeed?

I didn't compile it - when I ran the binary installer for IM, it gave
me the option to install PerlMagick.
...try adding some error checking ... or going through it
with the debugger....

Good suggestion, thanks.

I'd do away with opening a file handle, and just pass the file name to
the Read or Write method, much easier to code and maintain.

OK, I will try that -- the only reason I did that is I copied the code
(almost verbatim) from the PerlMagick doc.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top