Image Magick commands taking too much time to execute.

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
Posts: 1
Joined: 2017-09-15T07:57:03-07:00
Authentication code: 1151

Image Magick commands taking too much time to execute.

Post by atf4_solace » 2017-09-15T08:13:03-07:00

Hi Team,

We are using sequence of commands to generate one output through imagemagic command.

Image used in first command is here - ... 50373.jpeg
Just for quick reference, here is what each command does.

Here are the commands.

Code: Select all

"/usr/bin/convert" 15049951621774150373.jpeg -scale 3600x2400! solace_tmp_0.png
cp solace_tmp_0.png solace_dummy.png
mogrify -extent 3600x2400 -background "#FFFFFF" -gravity Center solace_dummy.png
"/usr/bin/convert" solace_dummy.png -fill black -draw "color 0,0 reset" solace_dummy.png
"/usr/bin/convert" solace_dummy.png -draw "image over 0,0+3600+2400 '15049951621774150373.jpeg'" solace_merge_0.png
cp solace_merge_0.png solace_first.png
mogrify -extent 4800x3600 -background "#FFFFFF" -gravity Center solace_first.png
"/usr/bin/convert" solace_first.png -fill white -draw "color 0,0 reset" solace_first.png
"/usr/bin/convert" solace_first.png -draw "image over 600,600+3600+2400 'solace_merge_0.png'" solace_main_final.png
cp solace_main_final.png solace_first.png
"/usr/bin/convert" solace_main_final.png -font /fonts/arial/arial.ttf -pointsize 19.935 -fill red -annotate +0+3596 " Text 1 " solace_main_final.png
"/usr/bin/convert" solace_main_final.png -font /fonts/arial/arial.ttf -pointsize 19.935 -fill black -annotate +0+3596 " Text 2 " solace_main_final.png
"/usr/bin/convert" solace_main_final.png -draw "image over 1453,3521+75+75 'solace_qr_image.png'" solace_main_final.png

1. Resizing the original image and generate the TEMP.>> 9 seconds
2. Copy the image to dummy image.
2. Mogrify it to add extra space as dummy image.>> 8 seconds
3. Apply black color to the image dummy image.>> 2 seconds
4. Place original image in dummy image and say merge image.>> 11 seconds
5. Copy Merge image to first image
6. Mogrify the first image to original width and height.>> 8 seconds
7. Apply color white to first image.>> 1 seconds
8. Assinged the first image to master variable
8. Create a main final image by placing the merge image onto the master image.>> 11 seconds
9. Main final image copied to master image.
10.Draw text 1 on image>> 9 seconds
11.Draw text 2 on image>> 10 seconds
12 Draw QR image on image.>> 10 seconds

My Imagemagic installation details -
Version: ImageMagick 6.9.3-8 Q16 x86_64 2017-06-12
Features: Cipher DPC OpenMP

Execution of above commands take total 82 seconds at my end. Individual timings are mentioned as well above.

Can you please try running these commands at your server with same image and mention me how much total time its taking on your server?
If its taking less time, please mention configuration of your sever and details of Imagemagic installation.


User avatar
Posts: 22652
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image Magick commands taking too much time to execute.

Post by fmw42 » 2017-09-15T08:41:55-07:00

This seems to be a duplicate post of viewtopic.php?f=1&t=32698#p149733. Is this really new? If not, then please do not post to multiple forum in the future.

The time taken was explained by snibgo as due to using multiple commands rather than one long command and thus having to read and write your intermediate png files.

Post Reply