Page 1 of 1

Extremely slow image resize

Posted: 2012-05-03T03:53:15-07:00
by danc81
Hi,

I'm using ImageMagick to convert some large TIFs (14000x14000) to smaller sizes - 8000x8000, 4000x4000 and 2000x2000, in GIMP and Photoshop this takes seconds but ImageMagick takes hours. My command line is:

convert "<path>\<to>\<input>" -resize 2000x2000 "<path>\<to>\<output>"

Running on a quad core Windows 7 64 box with 4GB of RAM. CPU sits at anywhere between 1% and 25% for a couple of hours before producing output.

Any ideas how to speed this up?

Thanks

Re: Extremely slow image resize

Posted: 2012-05-03T07:49:11-07:00
by stefan9
try the "sample" operator.
The "-sample" resize operator is the fastest resize operator, especially in large scale image reduction.
http://www.imagemagick.org/Usage/resize/#sample

also try "Resize During Image Read" with [2000x2000] direct after the filename

Re: Extremely slow image resize

Posted: 2012-05-03T10:14:45-07:00
by fmw42
I am no expert on this, but I believe that is because those other tools put the whole image into memory. IM has a different memory management and process in smaller parts.

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

Re: Extremely slow image resize

Posted: 2012-05-03T12:46:49-07:00
by danc81
This is a strange one. I experienced the problem with the latest dynamic Q16 version but I replaced it with the Q16 static standalone version and they resize just as quickly the other tools. Seems there may be something different about the way the 2 handle large files?

Re: Extremely slow image resize

Posted: 2012-05-03T14:14:08-07:00
by fmw42
Do you have multiple processors? If so, you can try compiling without openmp. I am not sure if that is available on Window IM. But you can check from convert -version and it will say if OpenMP is there. Otherwise, I am at a loss and you will need to get a response from the IM developers.

Re: Extremely slow image resize

Posted: 2012-05-03T17:29:41-07:00
by anthony
Extremely slow is caused by ImageMagick reaching memory limits (which may be settable), and as a result offloading the image processing to disk. Using a Q8 version of IM will make it much faster as it will use half the memory as a Q16. Presumably you get some othe rreduction in memory from using the other version of IM (or perhaps memory limits are set different)

An alternative is to unlimit the memory limit and allow the machine to do 'swapping' itself as needed.
But a swapping machine can be just as slow!