Speed-up tips for -unsharp

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
bookpub1

Speed-up tips for -unsharp

Post by bookpub1 »

Background:

1. <http://redskiesatnight.com/Articles/IMsharpen/> gives these suggestions on radius values:

-unsharp <radius>{x<sigma>}{+<amount>}{+<threshold>}

How do you know how big of a radius to use? It depends on your output target resolution, for one thing. It also depends on your personal preferences, as well as the specific needs of the image at hand. As far as the resolution issue goes, the GIMP User Manual recommends that unsharp mask radius be set as follows:

radius = (output ppi / 30) * 0.2

Which is very similar to another commonly found rule of thumb:

radius = output ppi / 150


2. Anthony said this (in another thread) about -unsharp :
[[ The most important factor is the sigma. As it is the real control of the sharpening operation. It is only due to hostorical accident it is the second term in the above. It can be any floating point value from .1 for practically no sharpening to 3 or more for sever shaprening. 0.5 to 1.0 is rather good. Radius is just a limit of the effect as is the threshold. Radius is only in interger units as that is the way the algorithm works, the larger it is the slower it is. But it should be at a minumum 1 or better still 2 times the sigma. ]]

Now the QUESTIONS:

My final output for a book publishing project has to be 600 dpi, which per #1 would indicate that my radius should be 4 and my sigma 2. But when I ran -unsharp at 0x1 it took 5 hours to finish a 1.0M JPEG! I'm using a PowerPC Mac operating at 1.8 gz with no special graphics processing hardware. And... I have 100+ pages to do.

So:

a) Is 5 hours to -unsharp a 1M scanned JPEG (text document) sound about right, or is something very wrong??
b) what software variables should be taken into account to speed things up? e.g. not running other apps, or running IM concurrently on several images at once
c) do I need to find another machine that has some kind of special graphics processor or other hardware, or tons of RAM, or faster clock speed, or ??

Any tips/suggestions will be appreciated!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Speed-up tips for -unsharp

Post by magick »

We have a 8960x6720 1MB JPEG image. With this command:
  • convert logo.jpg -unsharp 0x1 logo.miff
it ran in 53 seconds. We're running ImageMagick 6.3.5-6 on a dual-core 3GB Intel chip with 2GB of memory under Fedora.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Speed-up tips for -unsharp

Post by anthony »

More than likely your machine does not have enough real physical memory to handle the image without resorting to using 'swap space'. It could also be you are running some application which uses a LOT of memory, like a complex word processor, compiling, or even some bad web browsers. The result is 'thrashing' where IM and the computer OS has to 'page' extra memory from disk (very slow).

See http://en.wikipedia.org/wiki/Thrash_%28 ... science%29

Cristy's machine has a LOT of memory so the whole image was able to be processed from memory.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
bookpub1

Re: Speed-up tips for -unsharp

Post by bookpub1 »

Thank you both for the suggestions... I did a batch of images overnight and processed 180+ at about 10 minutes each... improved speed resulted from shutting down all other processes.

Amazing software, amazingly helpful list... thank you so much!!
Post Reply