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;
Major performance problem...
Re: Major performance problem...
Try turning off OpenMP. Rerun the configure command line script and add the --disable-openmp to the command line. After you build and install, convert -version should not list OpenMP as a feature.
Re: Major performance problem...
Thank you.
--disable-openmp has helped a lot.
Performance is now much more reasonable. Still looks a bit slow compared to my Windows box but this is something I can live with quite happily.
--disable-openmp has helped a lot.
Performance is now much more reasonable. Still looks a bit slow compared to my Windows box but this is something I can live with quite happily.
Re: Major performance problem...
And how can I speed up the performance?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Major performance problem...
What is your problem exactly? What command is running slow? What version of IM and platform are you running?
It is hard to tell from so little information!
Also it is generally best not to tack onto some one else's post. One should start one's own post.
Please clarify your problem and someone will likely be able to help further.
It is hard to tell from so little information!
Also it is generally best not to tack onto some one else's post. One should start one's own post.
Please clarify your problem and someone will likely be able to help further.