Major performance problem...
Posted: 2011-10-01T13:31:10-07:00
I have simple Perl/ImageMagick script that runs nicely on my Windows box.
However, when run on my CentOS server the performance is horrible. Each execution requires around 120MB of memory and 2.5 seconds of CPU.
It consumes about one tenth of those resources under Windows (much more reasonable).
Any suggestions?
www:/home/malch> convert -version
Version: ImageMagick 6.7.2-9 2011-10-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
I've just installed the above version; it was even worse under 6.6.9-9 which I was running previously.
#!/usr/bin/perl
$IMPATH = '/etc/httpd/fonts';
$ENV{MAGICK_CONFIGURE_PATH} = $IMPATH;
$text = "Here is the message";
$font = 'JIMMY1';
$size = 36;
use Image::Magick;
my $image = Image::Magick->new;
$image->Set(quality=>100);
$image->Set(type=>'truecolor');
$image->Set(size=>'2000x1000');
$image->ReadImage('xc:white');
$image->Annotate(x=>1000, y=>400, align=>'center', font=>$font, pointsize=>$size, fill=>'black', text=>$text);
$image->Trim();
($width, $height) = $image->Get('width', 'height');
$image->Set(type=>'truecolor');
$image->Set(magick=>'JPEG');
my $blob = $image->ImageToBlob();
undef $image;
#print "Content-Type: image/jpeg\r\n\r\n";
binmode (STDOUT);
print $blob;
exit;
However, when run on my CentOS server the performance is horrible. Each execution requires around 120MB of memory and 2.5 seconds of CPU.
It consumes about one tenth of those resources under Windows (much more reasonable).
Any suggestions?
www:/home/malch> convert -version
Version: ImageMagick 6.7.2-9 2011-10-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
I've just installed the above version; it was even worse under 6.6.9-9 which I was running previously.
#!/usr/bin/perl
$IMPATH = '/etc/httpd/fonts';
$ENV{MAGICK_CONFIGURE_PATH} = $IMPATH;
$text = "Here is the message";
$font = 'JIMMY1';
$size = 36;
use Image::Magick;
my $image = Image::Magick->new;
$image->Set(quality=>100);
$image->Set(type=>'truecolor');
$image->Set(size=>'2000x1000');
$image->ReadImage('xc:white');
$image->Annotate(x=>1000, y=>400, align=>'center', font=>$font, pointsize=>$size, fill=>'black', text=>$text);
$image->Trim();
($width, $height) = $image->Get('width', 'height');
$image->Set(type=>'truecolor');
$image->Set(magick=>'JPEG');
my $blob = $image->ImageToBlob();
undef $image;
#print "Content-Type: image/jpeg\r\n\r\n";
binmode (STDOUT);
print $blob;
exit;