Page 1 of 1

Thumbnail creation taking 20 - 40 seconds

Posted: 2012-02-20T18:33:01-07:00
by protogen
Hey all,

I'm creating thumbnails of photos taken with my 5MP digital camera, however it's taking anywhere from 20 to 40 seconds to create each thumbnail. Can anyone point me toward where the bottleneck might be?

CPU: Core 2 Duo E6300 (1.86GHz)
RAM: 4GB

# uname -a
SunOS server 5.11 snv_151a i86pc i386 i86pc

Compiled version 6.7.5-6 Q16 today
# /usr/local/imagemagick/bin/convert -version
Version: ImageMagick 6.7.5-6 2012-02-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:

Resources
# /usr/local/imagemagick/bin/convert -list resource
File Area Memory Map Disk Thread Time
-------------------------------------------------------------------------------
192 8.4341GB 3.9274GiB 7.8549GiB unlimited 1 unlimited

001.jpg is 5MP @ 100% quality, 002.jpg is 5MP @ 50% quality
# ls -l
-rw-r----- 1 craig user 2092528 Feb 21 11:49 001.jpg
-rw-r----- 1 craig user 770605 Mar 8 2011 002.jpg

001.jpg > jpg
# time /usr/local/imagemagick/bin/convert 001.jpg -thumbnail 128x128 tn_001.jpg
real 0m36.374s
user 0m36.218s
sys 0m0.095s

002.jpg > jpg
# time /usr/local/imagemagick/bin/convert 002.jpg -thumbnail 128x128 tn_002.jpg
real 0m24.587s
user 0m24.465s
sys 0m0.088s

002.jpg > png
# time /usr/local/imagemagick/bin/convert 002.jpg -thumbnail 128x128 tn_002.png
real 0m24.583s
user 0m24.468s
sys 0m0.086s

Older version installed too, same performance results
# /usr/bin/convert -version
Version: ImageMagick 6.3.4 10/12/10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

Cheers
Craig

Re: Thumbnail creation taking 20 - 40 seconds

Posted: 2012-02-20T18:41:00-07:00
by fmw42
Do you have two versions at the same location? That would not be wise.

What are the image dimensions? 5 Mpixels is 120 Mbytes for 3 channels once decompressed. Though that should not be a problem with RAM.

I am not an expert on this, but you could try
http://www.imagemagick.org/Usage/formats/#jpg_read

also see
http://www.imagemagick.org/Usage/files/#massive

Re: Thumbnail creation taking 20 - 40 seconds

Posted: 2012-02-20T19:48:55-07:00
by protogen
The two version of imagemagick are in different locations...
Version 6.3.4: /usr/bin/convert
Version 6.7.5-6: /usr/local/imagemagick/bin/convert

I've just rebooted the Solaris box (actually it was a forced reboot - the power company are doing maintenance work in my building and tripped my RCD - doh!) and look at the change...

# time /usr/local/imagemagick/bin/convert 001.jpg -thumbnail 128x128 tn_001.jpg
real 0m0.430s
user 0m0.342s
sys 0m0.067s

# time /usr/local/imagemagick/bin/convert 002.jpg -thumbnail 128x128 tn_002.jpg

real 0m0.363s
user 0m0.276s
sys 0m0.066s

I'll have to keep an eye on this in future.

Re: Thumbnail creation taking 20 - 40 seconds

Posted: 2012-02-20T20:44:26-07:00
by anthony
Your box was probably doing something else at the time.

Imagemagick by default runs with Multi-threading enabled. This can become very slow when another program is also running and it is also trying to do multi-threading.

You can turn off mutli-threading in IM by doing...

Code: Select all

    export MAGICK_THREAD_LIMIT=1