My convert resize become slow!!!HELP!!

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
hmc0316
Posts: 4
Joined: 2011-04-19T03:34:25-07:00
Authentication code: 8675308

My convert resize become slow!!!HELP!!

Post by hmc0316 »

dear all,
I use IM to convert jpeg about six month ago, but convert become slow lately.

I don't know why, and I found goole or anything cannot give me any answer...anyone can help me??

environment:ImageMagick-6.6.9-5,httpd-2.2.10, php-5.2.6

Code: Select all

./configure --disable-openmp --without-x
my code

Code: Select all

bash-3.00$ time convert -size 480x640 IMG_0123.JPG -fill '#00cc33' -pointsize 96 -font 8.ttf -draw "text 20,146' www.xxx.com '" -resize 480x640 -quality 80% ok.jpg
real    0m2.239s
user    0m2.113s
sys     0m0.118s
another pur resize

Code: Select all

bash-3.00$ time convert -resize 480x640 IMG_0123.JPG ok.jpg

real    0m2.794s
user    0m2.662s
sys     0m0.125s
identify

Code: Select all

bash-3.00$ identify -list resource
File         Area       Memory          Map         Disk    Thread         Time
-------------------------------------------------------------------------------
 768     3.1499GB    11.734GiB    23.469GiB    unlimited         1    unlimited
convert --version

Code: Select all

bash-3.00$ /usr/local/bin/convert --version
Version: ImageMagick 6.6.9-5 2011-04-15 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features:
BTW, My server cpu and ram stats is

Code: Select all


 18:53:47 up 3 days, 17:16,  1 user,  load average: 0.55, 0.61, 0.60
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    xxx.xxx.xxx.xxx   18:36    0.00s  0.07s  0.01s w
bash-3.00$ free
             total       used       free     shared    buffers     cached
Mem:      12304440   12002036     302404          0     389616    6950916
-/+ buffers/cache:    4661504    7642936
Swap:      1052248        160    1052088

thanks you very much....Matt Huang
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: My convert resize become slow!!!HELP!!

Post by magick »

We ran your command on our Linux system with ImageMagick 6.6.9-5 and got:
  • sh-4.2$ time convert -size 480x640 IMG_0123.JPG -fill '#00cc33' -pointsize 96 -font 8.ttf -draw "text 20,146' www.xxx.com '" -resize 480x640 -quality 80% ok.jpg

    real 0m0.026s
    user 0m0.026s
    sys 0m0.013s
See if there is a particular part of the command line causing the slow-down:
  • time convert -size 480x640 IMG_0123.JPG -quality 80 ok.jpg
    time convert -size 480x640 IMG_0123.JPG -resize 480x640 -quality 80% ok.jpg
    time convert -size 480x640 IMG_0123.JPG -fill '#00cc33' -pointsize 96 -font 8.ttf -draw "text 20,146' www.xxx.com '" -quality 80% ok.jpg
Verify that the system load average is reasonable (uptime / top).
hmc0316
Posts: 4
Joined: 2011-04-19T03:34:25-07:00
Authentication code: 8675308

Re: My convert resize become slow!!!HELP!!

Post by hmc0316 »

hi,magick~
thanks for your rpely. I really don't know what happen to "IM convert resize".

The command 's reule.....

Code: Select all

   
 bash-3.00$ time convert -size 480x640 IMG_0123.JPG -quality 80 ok.jpg

real    0m1.756s
user    0m1.441s
sys     0m0.156s

Code: Select all


bash-3.00$ time convert -size 480x640 IMG_0123.JPG -resize 480x640 -quality 80% ok.jpg

real    0m2.814s
user    0m2.629s
sys     0m0.129s

Code: Select all



bash-3.00$ time convert -size 480x640 IMG_0123.JPG -fill '#00cc33' -pointsize 96 -font 8.ttf -draw "text 20,146' www.xxx.com '" -quality 80% ok.jpg

real    0m1.722s
user    0m1.514s
sys     0m0.179s

my command

Code: Select all

bash-3.00$ time convert -size 480x640 IMG_0123.JPG -fill '#00cc33' -pointsize 96 -font 8.ttf -draw "text 20,146' www.houseweb.com.tw '" -resize 480x640 -quality 80% ok.jpg

real    0m2.217s
user    0m2.095s
sys     0m0.112s
uptime

Code: Select all

20:29:01 up 3 days, 18:51,  1 user,  load average: 0.50, 0.59, 0.56
top

Code: Select all

top - 20:29:55 up 3 days, 18:52,  1 user,  load average: 0.87, 0.66, 0.58
Tasks: 197 total,   1 running, 196 sleeping,   0 stopped,   0 zombie
Cpu(s):  8.2% us,  1.8% sy,  0.0% ni, 87.7% id,  1.7% wa,  0.2% hi,  0.5% si
Mem:  12304440k total, 12209164k used,    95276k free,   259688k buffers
Swap:  1052248k total,      160k used,  1052088k free,  7484560k cached


I think if I add "-resize" , convert will be slow....
Thank you , Magick~~
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: My convert resize become slow!!!HELP!!

Post by magick »

Type
  • identify -list configure
Does your CFLAGS tag include -O. Let's make sure ImageMagick was compiled optimized.
hmc0316
Posts: 4
Joined: 2011-04-19T03:34:25-07:00
Authentication code: 8675308

Re: My convert resize become slow!!!HELP!!

Post by hmc0316 »

dear Magick,
I really think my system have some problem, and do not let IM speed up...thanks a lot..

identify -list configure

Code: Select all


Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99 -std=gnu99
CFLAGS        -g -O2 -Wall -pthread
CODER_PATH    /usr/local/lib/ImageMagick-6.6.9/modules-Q16/coders
CONFIGURE     ./configure  '--disable-openmp' '--without-x'
CONFIGURE_PATH /usr/local/etc/ImageMagick/
COPYRIGHT     Copyright (C) 1999-2011 ImageMagick Studio LLC
CPPFLAGS      -I/usr/local/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     bzlib freetype jpeg jng png zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=                                              no --with-autotrace=no --with-fontconfig=no --with-gslib=no --with-fontpath= --w                                              ith-rsvg=no --with-xml=no --with-perl=no
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick-6.6.9/
EXEC-PREFIX   /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES
FILTER_PATH   /usr/local/lib/ImageMagick-6.6.9/modules-Q16/filters
HOST          x86_64-unknown-linux-gnu
LDFLAGS       -L/usr/local/lib
LIB_VERSION   0x669
LIB_VERSION_NUMBER 6,6,9,5
LIBRARY_PATH  /usr/local/lib/ImageMagick-6.6.9
LIBS          -lMagickCore -lfreetype -ljpeg -lpng -lbz2 -lz -lm -lpthread
NAME          ImageMagick
PCFLAGS
PREFIX        /usr/local
QuantumDepth  16
RELEASE_DATE  2011-04-15
SHARE_PATH    /usr/local/share/ImageMagick-6.6.9
SVN_REVISION  exported
TARGET_CPU    x86_64
TARGET_OS     linux-gnu
TARGET_VENDOR unknown
VERSION       6.6.9
WEBSITE       http://www.imagemagick.org

Path: [built-in]

Name          Value
-------------------------------------------------------------------------------
NAME          ImageMagick

What's mean "CFLAGS tag include -O"??
thanks again...
Matt Huang~
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: My convert resize become slow!!!HELP!!

Post by NicolasRobidoux »

hmc0316 wrote: identify -list configure

Code: Select all

...
CFLAGS        -g -O2 -Wall -pthread
...
What's mean "CFLAGS tag include -O"??
...
It means that IM was compiled with (gcc) optimization. "-O2" (note that it starts with "-O") means that it was optimized with "level 2" optimization, basically the standard.
hmc0316
Posts: 4
Joined: 2011-04-19T03:34:25-07:00
Authentication code: 8675308

Re: My convert resize become slow!!!HELP!!

Post by hmc0316 »

hi,NicolasRobidoux

I apprectiate your reply,so what can I do for IM configuration.

Code: Select all

   ...
   CFLAGS        -g -O2 -Wall -pthread
   . ..
  
this is my configure for my IM now.

Code: Select all

./configure --disable-openmp --without-x
Could you give me suggestion for my slow IM resize command?

thanks again.

Matt Huang~~
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: My convert resize become slow!!!HELP!!

Post by fmw42 »

convert -size 480x640 IMG_0123.JPG ...
The jpg size hint has changed to a define in recent versions of IM. See http://www.imagemagick.org/Usage/formats/#jpg_read
euromark
Posts: 1
Joined: 2011-07-19T01:49:44-07:00
Authentication code: 8675308

Re: My convert resize become slow!!!HELP!!

Post by euromark »

ah
I finally found someone that has the same problems
since upgrade to Debian Sqeeze it renders an image every 1 minute (!!!).
for a gallery this takes hours to display the thumbnails. thats absolutely crazy... :(

its on 100% processor capacity for this time
and load average pretty soon hits > 20!
the complete website is slowed down because of this

Code: Select all

CC            gcc -std=gnu99 -std=gnu99
CFLAGS        -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/i                               nclude -fopenmp -g -O2 -Wall -W -pthread
CONFIGURE     ./configure  '--prefix=/usr' '--mandir=${prefix}/share/man' '--inf                               odir=${prefix}/share/info' '--with-modules' '--with-gs-font-dir=/usr/share/fonts                               /type1/gsfonts' '--with-magick-plus-plus' '--with-djvu' '--enable-shared' '--wit                               hout-dps' '--without-fpx' '--with-perl-options=INSTALLDIRS=vendor' '--x-includes                               =/usr/include/X11' '--x-libraries=/usr/lib/X11' 'CFLAGS=-g -O2' 'LDFLAGS=' 'CPPF                               LAGS=' 'CXXFLAGS=-g -O2'
COPYRIGHT     Copyright (C) 1999-2010 ImageMagick Studio LLC
CPPFLAGS      -I/usr/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -Wall -W -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     bzlib djvu fontconfig freetype gvc jpeg jng jp2 lcms lqr openexr p                               ng rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-g -O2' 'CPPFLAGS=' 'LDFLAGS=' --disable-deprecat                               ed --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-dps=no --wi                               th-fpx=no --with-gslib=no --with-fontpath= --with-gs-font-dir=/usr/share/fonts/t                               ype1/gsfonts
EXEC-PREFIX   /usr
HOST          x86_64-unknown-linux-gnu
LDFLAGS       -L/usr/lib -L/usr/lib/X11
LIB_VERSION   0x660
LIB_VERSION_NUMBER 6,6,0,4
LIBS          -lMagickCore -llcms -ltiff -lfreetype -ljpeg -llqr-1 -lglib-2.0 -l                               fontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr
QuantumDepth  16
RELEASE_DATE  2010-11-16
VERSION       6.6.0
WEBSITE       http://www.imagemagick.org
Post Reply