Page 1 of 1
Adaptive sharpen slow - any way to speed up?
Posted: 2019-10-17T10:16:48-07:00
by ulrichlang
Hi!
I'm using convert to do adaptive sharpen (usually with 0x1) and it is really slow. Does anyone know how to speed it up?
Thank you for anyone willing to help out!
Best
Ulrich
Re: Adaptive sharpen slow - any way to speed up?
Posted: 2019-10-17T10:22:28-07:00
by fmw42
What is your Imagemagick version, Q level and platform? How big is your image? Do you have enough RAM for the process?
Re: Adaptive sharpen slow - any way to speed up?
Posted: 2019-10-17T17:42:52-07:00
by ulrichlang
Thanks for getting back to me.
Ubuntu 18.04.3 LTS
when I run "convert -version" I get:
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License:
http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
The image is 730KB, 5760x3589 - here is a temporary link to the image:
https://objectsecurity.com/tmp/tmpimg.jpg
I don't know the Q level - how can I find that out?
Thanks!
Ulrich
Re: Adaptive sharpen slow - any way to speed up?
Posted: 2019-10-17T18:15:54-07:00
by fmw42
You are using Q16 as per your listed information. However, the date of your version is 20170114, which is 2.5 years old (01/14/2017). You should see if there is an upgrade or patch to a current date.
How many cores does your computer have. More cores means faster processing, generally. However, on some systems, disabling OpenMP can make it run faster for certain operations. But this is rare.
For large (dimensions) images, see
https://imagemagick.org/Usage/files/#massive.
Adjusting your policy.xml file may also provide some benefit for large images.
Recompiling to Q8 may also help by using less RAM.
Otherwise, I am not sure how you can improve speed with Imagemagick. If your speed is unacceptable, then perhaps look into the VIPS image processing tool.
You have never said what the speed is?
If I have computed correctly, your size image for 3 channels would be 5420520 bytes = 5.4 GB for the input and likewise for the output. Do you have about 11 GB RAM available? Adjusting the policy.xml file may help. But if you are on a shared server, your host may not be willing to change it. See
https://imagemagick.org/script/resources.php for the policy.xml adjustments. Sorry, I am not an expert on these -limit arguments.
See
to get your current limits.
Re: Adaptive sharpen slow - any way to speed up?
Posted: 2019-10-17T20:49:30-07:00
by snibgo
At 8 bytes/pixel, each copy of the 5760x3589 image needs 0.165 GB. Adaptive sharpen needs two more copies, so we need 0.5 GB.
@ulrichlang: What is your command, and how long does it take? Eg "magick tmpimg.jpg -adaptive-sharpen 5x1 NULL:" on my 2.4GHz laptop takes 22 seconds.
Check that no temporary files are created during the command. If they are, you have run out of memory.
Check that "-limit thread 1" increases the time required. If it does, then multi-threading is useful for you.
If you have run out of memory, then try it with no other progams running (eg web browsers). If that doesn't cure the problem, insert "-list resource" to check there are no unwanted limits. Also try with Q8 to halve the memory usage.
Re: Adaptive sharpen slow - any way to speed up?
Posted: 2019-10-18T11:41:10-07:00
by ulrichlang
Hi! Thanks!!! wow, yes there were some really low resource limits set. I didn't know those were set so low. I am runnning this in a high-cpu cloud instance and now that processes the image in 18 seconds (vs. 2-4 minutes before). Thanks again!
(PS the low limits are default set up when installing "out of the box" on ubuntu)