Thumbnail creation taking 20 - 40 seconds

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
protogen
Posts: 2
Joined: 2012-02-20T17:41:13-07:00
Authentication code: 8675308

Thumbnail creation taking 20 - 40 seconds

Post 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
Last edited by protogen on 2012-02-20T20:18:58-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Thumbnail creation taking 20 - 40 seconds

Post 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
protogen
Posts: 2
Joined: 2012-02-20T17:41:13-07:00
Authentication code: 8675308

Re: Thumbnail creation taking 20 - 40 seconds

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Thumbnail creation taking 20 - 40 seconds

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply