Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
We are using Perlmagick (Image::Magick) 6.0 for some time. We upgraded to 6.3.3 (CentOS, with 1GB of memory) and now the same program runs at of memory converting a 12Mb single page PDF file to a JPEG file.
While it use to die and report 'Endless loop' and 'Out of Memory', it might have been because we did not update Perlmagick but only Imagemagick. I since removed all 6.0 rpms, and reinstalled Imagemagick and perlmagick from source. Now it kswapd0 continually but does not compete or die.
#!/usr/bin/perl -w
# $Id: myconvert.pl 26 2007-04-16 20:25:17Z dlink $
# This program behaves like a wrapper to ImageMagick's convert
# command line program. It allows us to: crop, rotate, and resize
# in that order, while the command line does not.
use strict;
use Image::Magick;
# inputs:
my ($crop, $rotation, $width, $input, $output) = @ARGV;
print "$crop, $rotation, $width, $input, $output\n" if $DEBUG;
die "myconvert.pl: incorrect number of arguments.\n" if $#ARGV != 4;
# Processing:
my $image = Image::Magick->new;
# Read
my $rc = $image->Read($input);
die $rc if "$rc";
# Crop
$rc = $image->Crop(geometry => $crop);
die $rc if $rc;
# Rotate
if ($rotation) {
$rc = $image->Rotate($rotation);
die $rc if $rc;
}
# Resize
$rc = $image->Resize($width);
die $rc if $rc;
# Write out
$rc = $image->Write($output);
die $rc if $rc;
Yes, I'm seeing the same problem when running `make check' in the freshly built directory (6.3.5-3). The t/blob.t test, for example, reached the following record in top:
We have not heard this problem report before and unfortunately we currently cannot reproduce the problem. The posted PerlMagick script works fine for us in just a few megabytes of memory.
/plant/myconvert.pl 798x618+0+28 0 800
/data/stage_book_archive/2007-07-20/900100/900100.pdf
/mypublisher/tmp/900100/output.jpg: Cant load
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Image/Magick
/Magick.so
for module Image::Magick: libMagick.so.10: cannot open shared object
file: No such file or directory at
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230. -
at /plant/myconvert.pl line 18 - Compilation failed in require at
/plant/myconvert.pl line 18. - BEGIN failed--compilation aborted at
/plant/myconvert.pl line 18. - Deep recursion on subroutine
"Image::Magick::AUTOLOAD" at
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Image/Magick.pm
line 42. - Out of memory!
I've seen this problem before (on FreeBSD), and -- contrary to assertions by "magick" -- it was reported on this very forum by myself and others.
It stems from PerlMagick being unable to load libMagick.so:
dlink wrote:
for module Image::Magick: libMagick.so.10: cannot open shared object
file: No such file or directory at
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230. -
Somehow this fairly trivial problem leads to a "cascading failure" leading to perl consuming all available memory before dying. I'm not sure, whether this is a bug in PerlMagick or in perl -- someone, who is good with the language, will need to investigate.
Once you figure this out -- by setting LD_LIBRARY_PATH to include the location of libMagick.so.10 or whatever else it takes on your OS -- the "runs out of memory" issue will go away too.