How to optimize ImageMagick
How to optimize ImageMagick
Hi,
My web server uses ImageMagick intensively (image resize, animations). I still use IM 6.2.8. Today I tried the latest version but it seems that new IM needs more resources. I'm thinking about IM optimization. I tried to disable OpenMP -- no luck. Still high load. Is there any options I can disable with "configure" to reduce memory/cpu consumption?
Thanks in advance.
Greg.
My web server uses ImageMagick intensively (image resize, animations). I still use IM 6.2.8. Today I tried the latest version but it seems that new IM needs more resources. I'm thinking about IM optimization. I tried to disable OpenMP -- no luck. Still high load. Is there any options I can disable with "configure" to reduce memory/cpu consumption?
Thanks in advance.
Greg.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to optimize ImageMagick
install as Q8 rather than Q16 may help
Re: How to optimize ImageMagick
Will it reduce the quality of images? What is the difference?
Re: How to optimize ImageMagick
After you disabled OpenMP, did you verify it was turned off:
- identify -version
Re: How to optimize ImageMagick
Yes, OpenMP is disabled.
The problem is not in the version of IM. I just want to reduce the memory/cpu consumption as much as possible because of intensively using of IM.
That's why I'm asking about some options I can disable to improve the perfomance of IM.
The problem is not in the version of IM. I just want to reduce the memory/cpu consumption as much as possible because of intensively using of IM.
That's why I'm asking about some options I can disable to improve the perfomance of IM.
Re: How to optimize ImageMagick
Add --with-quantum-depth=8 to your configure script command line. It will create a Q8 version of ImageMagick which uses half the memory and is about 20% faster than the Q16 version. Q8 processes all images as 8-bit whereas Q16 processes at 16-bits. The extra precision may not be necessary if most of your images are 8-bit (e.g. most JPEG images are 8-bit).
Re: How to optimize ImageMagick
Can you please tell me which types of images are 16-bit? PNG 24-bit? The problem is that my web server creates animations from any image sources so it's not okay to exclude some types of images.
Re: How to optimize ImageMagick
ImageMagick can read any format its supports whether its 8-bit or 16-bit. That's 8-bit per pixel component, each of read, green, blue, and alpha. 16-bit is generally only needed for high-end production systems. However, 16-bit is becoming more prevalent now-a-days. PNG and Photoshop formats for example support 16-bit per pixel component.
Re: How to optimize ImageMagick
I've installed latest IM in /usr/local. Also I have 6.2.8 in /usr.
I've tested each version of IM within 5 minutes. 6.2.8 makes an 0.86 average server load while 6.6.0-9 makes 1.5-1.8.
I've just edited the config file in my project from /usr/bin/convert to /usr/local/bin/convert.
I still have to use 6.2.8.
Is there any reason why new version generates high server load?
I've tested each version of IM within 5 minutes. 6.2.8 makes an 0.86 average server load while 6.6.0-9 makes 1.5-1.8.
I've just edited the config file in my project from /usr/bin/convert to /usr/local/bin/convert.
I still have to use 6.2.8.

Re: How to optimize ImageMagick
Server loads are too nebulous to address what the problem could be. Instead is there a command line or set of command lines that you generally use. We'll profile them in 6.2.8 and 6.6.0. Profiling identifies exactly which methods are consuming the most time and will help us identify any bottleneck. We use ImageMagick 6.6.0 @ http://www.imagemagick.org/MagickStudio ... Studio.cgi and service load is seldom above 1 (and we get thousands of users each day).
Re: How to optimize ImageMagick
Why did you compare server load on 2 different servers?
I use this commands:
/usr/bin/convert sourceimage.gif -strip -resize SIZE image.gif
/usr/bin/convert -delay SPEED -page HxW -dispose background /path/to/img*.gif -loop 0 /path/to/result/image.gif
Nothing more.
P.S.: I have approx. 15-20 thousand of users per day.
I use this commands:
/usr/bin/convert sourceimage.gif -strip -resize SIZE image.gif
/usr/bin/convert -delay SPEED -page HxW -dispose background /path/to/img*.gif -loop 0 /path/to/result/image.gif
Nothing more.
P.S.: I have approx. 15-20 thousand of users per day.
Re: How to optimize ImageMagick
We'll take a look at the problem and report back. Some immediate optimizations are to combine your work into one command instead of 2. That will reduce process overhead by only invoking the convert program once. Another optimization is to use a scripting language rather than the command line. We use Imagick for PHP and PerlMagick for Perl and get improved performance.
Re: How to optimize ImageMagick
I'll try to use IMagick.
Do you need any additional information? Maybe IM configs or something else?
Do you need any additional information? Maybe IM configs or something else?
Re: How to optimize ImageMagick
For our testings, tell us generally how many images are processed with /path/to/img*.gif and what is there average size (e.g. 320x240)?
Re: How to optimize ImageMagick
Typically, from 1 to 6.how many images are processed with /path/to/img*.gif
The maximum width is 450 pixels (when IM makes an animation; not when it resizes source photos). I can't tell you an average size because users define the size manually but many users choose 300px wide.what is there average size (e.g. 320x240)