IM Unsharp vs PS USM

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
bsguy
Posts: 1
Joined: 2013-12-03T21:00:18-07:00
Authentication code: 6789

IM Unsharp vs PS USM

Post by bsguy »

Hi All

I have a problem replicating a result from PhotoShop. I have a client who runs and image through a 2 step process in PhotoShop.

Step 1: Unsharp Mask Amount 18%, Radius 30 pixels, Threshold 4
Step 2: Unsharp Mask Amount 190%, Radius .5 pixels, Threshold 4

I've tried to replicate the result using the equivalents listed below.

Step 1: Unsharp Mask Amount .18, Radius 30, Threshold 0.0156
Step 2: Unsharp Mask Amount 1.9, Radius .5, Threshold 0.0156

I've experimented trying to vary sigma as a function of radius and vice versa but have not had satisfactory results.

In short, does anyone know the function for sigma to achieve a result similar to PS in my scenario?

Thanks
Danny
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM Unsharp vs PS USM

Post by snibgo »

IM's "-unsharp" can take both radius and sigma. See http://www.imagemagick.org/script/comma ... hp#unsharp

When setting just sigma the effect can theoretically spread infinitely far, so set radius to limit the effect. As a rule of thumb set radius to 3 times sigma. Do set sigma. This has more effect than radius on its own. If you just set radius I don't know what sigma IM uses.

If you like you could put up some samples. An original image, then 2 of that image at different amounts, another two of different radiuses and a third pair of different thresholds. Vary just one parameter within each pair. Then someone might try to replicate the results in IM. (Not me as I'm about to go to bed.)

You can put the images somewhere like dropbox.com and paste the URLs here.
snibgo's IM pages: im.snibgo.com
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: IM Unsharp vs PS USM

Post by GreenKoopa »

I don't have Photoshop, but I did recently have this same question using GIMP. See topic:

unsharp parameters: GIMP -> IM
viewtopic.php?f=1&t=23747

I found amount/gain and threshold to work as I expected. My issue was with converting radius & sigma. I found:
GreenKoopa wrote: viewtopic.php?f=1&t=23747#p100643
IM Sigma is GIMP Radius plus not quite one, and IM radius is twice that."
So try using Photoshop's radius as ImageMagick's sigma, possibly +1. Radius is probably best left as 0, allowing IM to calculate a reasonable value. I think GIMP limits it to 2x sigma because GIMP is limited to 8-bit precision.

If you want an exact match, I came up with a simple quantitative test.
GreenKoopa wrote: viewtopic.php?f=1&t=23747#p101287
I created an image that was one edge, with the left half dark and the right half light. I sharpened this test image using GIMP. I then took the middle row and graphed the pixel values. It is easy to see the radius, simply count how far out pixels changed. With the IM radius set, I varied sigma until the graphs matched. It was sigma = GIMP Radius + almost 1, which was half the previously noted radius. I ran tests through the ranges noted above.
Drazick
Posts: 12
Joined: 2014-04-27T10:33:50-07:00
Authentication code: 6789

Re: IM Unsharp vs PS USM

Post by Drazick »

I think Photoshop's Unsharp Mask is completely different from IM and GIMP.
Look here:

viewtopic.php?f=22&t=25477
Post Reply