How to optimize ImageMagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to optimize ImageMagick

Post by magick »

We profiled (timing + gprof) against ImageMagick 6.6.0, the current release, and 6.2.8 an older release, and we got identical results when converting 6 320x240 GIF images to GIF. The memory requirements for version 6.6.0 was slightly less than 6.2.8. We're not sure what is causing an increased load average on your computer. Color reduction was on average 0.05 seconds slower with ImageMagick 6.6.0.
gregory
Posts: 67
Joined: 2009-08-02T17:20:23-07:00
Authentication code: 8675309

Re: How to optimize ImageMagick

Post by gregory »

You've tested the memory consumption. What about CPU load? Especially, when you're using several (5-10-15) "convert"-proccesses at the same time.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to optimize ImageMagick

Post by magick »

We ran two convert processes in a loop. One resizes the logo 50% and the other appends 6 GIF images into one GIF animation. The loop iterated 2000 times. The 5 minute load average peaked at 4.18 and sustained about 4.1 for ImageMagick 6.2.8. ImageMagick 6.6.0 peaked at 4.01 and sustained at 3.85.

As mentioned, color reduction is more sophisticated in 6.6.0 so it takes a bit longer. For 200 iterations of resizing, color reduction, and generating a GIF image sequence, version 6.2.8 took 32 seconds elapsed, whereas 6.6.0 took 41. If we eliminate color reduction, 6.2.8 iterates 200 times at 8.3 seconds elasped, whereas ImageMagick 6.6.0 takes 6.4 seconds.
ecoverguru
Posts: 37
Joined: 2010-10-12T12:42:53-07:00
Authentication code: 8675308

NEED help urgent

Post by ecoverguru »

Hello,

I need URGENT help,

My old server was dual xeon 5660 (24 cores) and I had no problem with imagemagick 6.6.6-4

I got a new server dual xeon 5670 (24 cores) + 12 GB RAM with same version of imagemagick

Now I ran a small loadtest

The old server load 4.35 &
new server load 888..48

And ultimately became unstable and I had to reboot

I am not linux guy, and I am having someone else to manage my server, but they are and even the datacenter guys are unable to solve the problem.

Is it possible for you to log in to my server and solve the issue? I understand this would take your time and am ready to compensate it.

Thank you very much
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to optimize ImageMagick

Post by magick »

Does your instance of ImageMagick include support for OpenMP? Type
  • convert -version
Is the OpenMP feature listed? If so, add
  • <policy domain="resource" name="thread" value="2"/>
to the policy.xml file most likely in /usr/local/lib/ImageMagick-6.6.4/config/policy.xml. If that reduces server load, you can adjust the thread value.

You might consider bumping up to ImageMagick version 6.6.7-4, the latest release.
ecoverguru
Posts: 37
Joined: 2010-10-12T12:42:53-07:00
Authentication code: 8675308

Re: How to optimize ImageMagick

Post by ecoverguru »

Thanx for your help, I have forwarded this to Server guys..

OpenMP was supported, but I asked them to disable and see if it helps, but there was no difference. I will have it enable again and have reinstall the latest release as well.

BTW, name="thread" value="2" .. you mean if server load decreases, we can trying increasing the value? say value="10" etc?

Thanx again. I will update this thread with the results
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to optimize ImageMagick

Post by anthony »

Some basic and simple methods of speeding up IM is listed in
API & Scripting -- Making IM Faster (in general)
http://www.imagemagick.org/Usage/api/#speed

One of the methods for example is in stopping IM from reading some of its large configuration files.
Im by default will not read these unless it has to so using a color has rather than a color name will give a speed up.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ecoverguru
Posts: 37
Joined: 2010-10-12T12:42:53-07:00
Authentication code: 8675308

Re: How to optimize ImageMagick

Post by ecoverguru »

Unfortunately Nothing helped..

Here is the Screenshot I took from WHM showing processes, and you can see the CPU load for these processes.

Image


I was just wondering, if there are any additional libraries affecting imagemagick causing this heavy server load?

Is problem somewhere else? cause this is brand new server and the first thing we did is install imagemagick and I started doing this test.
ecoverguru
Posts: 37
Joined: 2010-10-12T12:42:53-07:00
Authentication code: 8675308

Re: How to optimize ImageMagick

Post by ecoverguru »

Sorry, I am new to this forum.... but I guess it would be better to continue in its own thread here. so created one here

viewtopic.php?f=1&t=17981

Thank you for your help
HelpMeMaybe
Posts: 1
Joined: 2012-07-25T16:34:16-07:00
Authentication code: 15

Re: How to optimize ImageMagick

Post by HelpMeMaybe »

We are running FocusOpen Digital Asset Manager, which uses ImageMagick for image processing.

ImageMagick-6.6.3-1-Q16-windows-dll.exe is the version in use.

We're maxing CPU at 100% when we try to process even 5 small jpgs at a time. Since we're not running this from the command line, b/c FocusOpen is making the call to ImageMagick, we cannot request the 8bit version via command line.

What do you recommend?

BTW- if we put in a high-end video card, will IM offload image processing to the video card RAM instead of to the CPU?
Post Reply