image magick takes too much time at linux server

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
sagar_solace
Posts: 3
Joined: 2014-08-29T07:58:24-07:00
Authentication code: 6789

image magick takes too much time at linux server

Post by sagar_solace »

I am facing an issue with time taken by imagemagic to execute the commands on my server. I also tried to make thread control from 20(default) to 1 but, no improvements.

Here are some of the commands we fire and time took for them on server. Is there any way to reduce this execution time?

# 1.
/usr/bin/convert source.jpeg -resize 4518.01x3013.01! output.png
real 0m13.150s
user 0m18.320s
sys 0m2.029s

# 2.
/usr/bin/convert source.png -draw image over 564.375,564.375+2408+3010 'placeholder.png' output.png
real 0m10.085s
user 0m11.160s
sys 0m1.710s

# 3.
/usr/bin/convert source.png -crop 2408x3010+1053.5+0 +repage output.png
real 0m5.978s
user 0m5.043s
sys 0m0.881s

MY SERVER DETAILS
Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-08-16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype gslib jng jpeg png ps tiff zlib
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: image magick takes too much time at linux server

Post by fmw42 »

This does not seem to be a request for PAID consulting. So I moved it to the Users forum.

Some functions may not work as well with OpenMP on certain OS. You could try disabling it. You could recompile as Q8. Otherwise, you probably cannot make these commands run any faster.

The times do seem rather long? How big is your source.jpg? What is your flavor of Linux?

Do you have plenty of RAM and plenty of space in Imagemagicks tmp location?

For -resize, you could use the faster -scale, but the quality will not be the same.
sagar_solace
Posts: 3
Joined: 2014-08-29T07:58:24-07:00
Authentication code: 6789

Re: image magick takes too much time at linux server

Post by sagar_solace »

Hi fmw42, thanks for your interest.
Here is server details
1. The times do seem rather long?
>> Not getting you.
2. How big is your source.jpg?
>> source.jpeg(600x400, 80.5kb) -resize 4518.01x3013.01! output.png
3. What is your flavor of Linux?
>> Os version is centos 6
4. Do you have plenty of RAM and plenty of space in Imagemagicks tmp location?
>> Ram 32 GB, (enough space at server for tmp folder)
5. For -resize, you could use the faster -scale, but the quality will not be the same.
>> Quality matters.
Thanks Sagar
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: image magick takes too much time at linux server

Post by fmw42 »

I tested on my 2.66 GHz Intel Core 2 Duo Mac OSX using IM 6.8.9.7 Q16 with one thread (no OpenMP)

Version: ImageMagick 6.8.9-7 Q16 x86_64 2014-08-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib

Code: Select all

time convert logo: -resize 4518.01x3013.01! output.png
real 0m2.984s
user 0m2.835s
sys 0m0.133s


The logo: image is 640x480.

Thus I would agree that your -resize time is too long.

I really do not know what to suggest.
sagar_solace
Posts: 3
Joined: 2014-08-29T07:58:24-07:00
Authentication code: 6789

Re: image magick takes too much time at linux server

Post by sagar_solace »

@fmw42 Can you please try with my source image? Here is my source image (http://solacetechnologies.co.in/project ... 19136.jpeg)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: image magick takes too much time at linux server

Post by fmw42 »

Code: Select all

time convert 1409319136.jpeg -resize 4518.01x3013.01! output.png
real 0m12.439s
user 0m12.069s
sys 0m0.167s

It is not your image. This also takes about the same time

Code: Select all

convert -size 600x400 gradient: tmp.jpg
time convert tmp.jpg -resize 4518.01x3013.01! output.png
real 0m13.129s
user 0m12.863s
sys 0m0.240s


My guess is that it is the decompression of the jpg that adds extra time to the processing.
Post Reply