Faster to bundle imagemagick commands then run separately?

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?".
Post Reply
gotskill10
Posts: 17
Joined: 2007-06-02T14:01:34-07:00

Faster to bundle imagemagick commands then run separately?

Post by gotskill10 »

This might be a case by case sort of question, but is it noticeably faster to bundle commands in a convert statement. Or does imagemagick just process commands in order, not optimizing several commands together. Im trying to figure out if I should be going to difficult lengths to keep the convert operations together instead of doing them seperately.

Anyone have some insight?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Faster to bundle imagemagick commands then run separately?

Post by fmw42 »

gotskill10 wrote:This might be a case by case sort of question, but is it noticeably faster to bundle commands in a convert statement. Or does imagemagick just process commands in order, not optimizing several commands together. Im trying to figure out if I should be going to difficult lengths to keep the convert operations together instead of doing them seperately.

Anyone have some insight?
One issue is that it takes time to write to intermediate/temporary images that will be thrown away at the end.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Faster to bundle imagemagick commands then run separately?

Post by el_supremo »

There's also the overhead of starting up a new process for each new convert command. If you are doing these operations frequently it can make quite a difference to the load on your system.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Faster to bundle imagemagick commands then run separately?

Post by anthony »

There is a very slight overhead in starting multiple convert commands. But it is tiny compared to the overhead of having to write and later re-read an image from disk. Than

As for the original question. IM does process each of the operations in the order given. However some are only a 'setting' for later operations. For example -background -fill -virtual-pixels -interpolate -set -define
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply