What resize settings can I apply to get the Photoshop USM sharpening shown in the last picture of this example?
http://www.xs4all.nl/~bvdwolf/main/foto ... ample1.htm
Is antialias a default resize setting when downsizing?
Thanks.
Photoshop USM sharpening with ImageMagick
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photoshop USM sharpening with ImageMagick
read these two pages from Anthony's notes about resizing, artifacts and using the resize expert setting to make things sharper
http://www.imagemagick.org/Usage/resize/#artifacts
http://www.imagemagick.org/Usage/resize/#filter
and especially the expert options.
http://www.imagemagick.org/Usage/resize/#filter_options
Also see Anthony's comments in the following post about Photoshop adding an unsharp masking to sharpen the pictures when it resizes.
viewtopic.php?f=1&t=13726&hilit=+photoshop
See also IM unsharp at http://www.imagemagick.org/script/comma ... hp#unsharp
http://www.imagemagick.org/Usage/resize/#artifacts
http://www.imagemagick.org/Usage/resize/#filter
and especially the expert options.
http://www.imagemagick.org/Usage/resize/#filter_options
Also see Anthony's comments in the following post about Photoshop adding an unsharp masking to sharpen the pictures when it resizes.
viewtopic.php?f=1&t=13726&hilit=+photoshop
See also IM unsharp at http://www.imagemagick.org/script/comma ... hp#unsharp
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photoshop USM sharpening with ImageMagick
Photo shop applied the resize operation, and then performs an unsharp operation to try to make the edges a little sharper.
I have not looked at, or experimented with unsharp so their is little in IM Examples. I have not found any other useful guides or tutorials on unsharp either, but haven't looked hard. If you find something, let me know.
See the raw notes Fred sent me in
http://www.imagemagick.org/Usage/convolve/#unsharp
(will appear in a couple of days)
I have not looked at, or experimented with unsharp so their is little in IM Examples. I have not found any other useful guides or tutorials on unsharp either, but haven't looked hard. If you find something, let me know.
See the raw notes Fred sent me in
http://www.imagemagick.org/Usage/convolve/#unsharp
(will appear in a couple of days)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Photoshop USM sharpening with ImageMagick
There is a lot of info. But it would be very useful to know exactly what amount of Photoshop radius, amount and thresold applied the guy who wrote that article, and if he tried to reproduce with ImageMagick. Simply to avoid testing.
I've read that 0.2 or 0.3 is recommended, but in that image it seems more 0.6 - 1.0 radius.
Well, in the comments it is said that sigma equals radius:
http://redskiesatnight.com/2005/04/06/s ... ge-magick/
Regards.
I've read that 0.2 or 0.3 is recommended, but in that image it seems more 0.6 - 1.0 radius.
Well, in the comments it is said that sigma equals radius:
http://redskiesatnight.com/2005/04/06/s ... ge-magick/
Regards.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photoshop USM sharpening with ImageMagick
Ideally radius is about 2 times sigma. It controls how big the 'convolution' is and thus theCarlos82 wrote:Well, in the comments it is said that sigma equals radius:
http://redskiesatnight.com/2005/04/06/s ... ge-magick/
overall speed. If your set radius to 0x{sigma} IM makes a internal choice for the radius based on the sigma.
Actually it does not matter much for a small sigma. Regardless the radius will then be about '1' (rounded up integer) as it is only used to determine the 'neighbourhood'.
See IM Examples on blur.
http://www.imagemagick.org/Usage/convolve/#blur
Unsharp is actually subtraction of the 'blur' of the image, so blur info is VERY relevant for its parameters.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Photoshop USM sharpening with ImageMagick
I believe that if you use radiusxsigma=0xsigma, then the effective radius will be about 3xsigma. See http://www.imagemagick.org/script/comma ... s.php#blur
"As a guideline, set r to approximately 3σ. If a radius of 0 is specified, ImageMagick selects a suitable radius for you."
Also see http://en.wikipedia.org/wiki/Gaussian_blur
"In theory, the Gaussian function at every point on the image will be non-zero, meaning that the entire image would need to be included in the calculations for each pixel. In practice, when computing a discrete approximation of the Gaussian function, pixels at a distance of more than 3σ are small enough to be considered effectively zero."
If you use 0xsigma, you get a Gaussian roll-off or profile for the filter (and a circular region of effect)
However, if you use radiusx65000 (or some very large number compared to radius), you get a linear roll-off or profile (and a square region of effect) And the size of the filter is just radius.
"As a guideline, set r to approximately 3σ. If a radius of 0 is specified, ImageMagick selects a suitable radius for you."
Also see http://en.wikipedia.org/wiki/Gaussian_blur
"In theory, the Gaussian function at every point on the image will be non-zero, meaning that the entire image would need to be included in the calculations for each pixel. In practice, when computing a discrete approximation of the Gaussian function, pixels at a distance of more than 3σ are small enough to be considered effectively zero."
If you use 0xsigma, you get a Gaussian roll-off or profile for the filter (and a circular region of effect)
However, if you use radiusx65000 (or some very large number compared to radius), you get a linear roll-off or profile (and a square region of effect) And the size of the filter is just radius.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photoshop USM sharpening with ImageMagick
As a FYI, if radius is defined the kernel width is set to 2*ceil(radius)+1fmw42 wrote:I believe that if you use radiusxsigma=0xsigma, then the effective radius will be about 3xsigma. See http://www.imagemagick.org/script/comma ... s.php#blur
"As a guideline, set r to approximately 3σ. If a radius of 0 is specified, ImageMagick selects a suitable radius for you."
If sigma very very small, width is set to 1 (usually no effect on result)
Otherwise the width calculated to be at least 5 (radius 3), which is then increased until overall sum of the bell curve (its weighted average) falls below numerical accuracy from the previous one. That is the weighted_average_sum*QuantumRange is less than 1.
In other words a Q8 ImageMagick (QuantumRange=255) will have a smaller blur kernel size than a Q16 version (QuantumRange=65355), as it does not have the precision needed for a Q16 kernel size. Of course Q16 kernel is also much smaller than a Q32 or Q64. HDRI does not effect this result as it is the Q level, used for output limits, that define this precision.
Not this is NOT linear, and could be larger than sigma*3. It is not only different for different IM, Q levels, but also different for a 1D kernel (as in -blur) verses a 2D kernel (as in -gaussian).
As an experiment I recompiled my IM with an added print statement for the final kernel 'width' that Im decided to use, in my Q16 IM
-blur 0x100 needed a 1D kernel size of 667 (radius = 333)
-gaussian 0x100 needed a 2D kernel size 667 as well!!! Even though they are different functions.
Remember while while doubling sigma effectivally doubles the width of the gaussian bell curve, the precise cut of may not be quite so linear. But in all my experiments the width always seems to be the same for 1D or 2D curves even though the functions are slightly different, Hmmm their seems to be a bug in the 2D version
Blur Sigma => radius IM decided on (minimum = radius 3)
1 => 4
2 => 8
3 => 12
5 => 20
10 => 34
20 => 75
50 => 176
100 => 333
1000 => 2558
10000 => 14885
For IM Q16 that is roughly ceil(sigma*3.33) for reasonable sigma's (less than 100)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Photoshop USM sharpening with ImageMagick
After fixing the normalization in the 2D determination (IM version 6.5.3-3) I get...anthony wrote:Hmmm their seems to be a bug in the 2D version
-blur 0x100 => radius = 333
-gaussian 0x100 => radius 470
So my bug fix while making IM more correct and accurate also makes it slower.
At least for 2d Gaussian kernals (which is not commonly needed).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/