Page 1 of 1

blur variable radius

Posted: 2019-05-01T06:36:56-07:00
by ingo
Many many moons ago in B&W printing we did a little trick with blurring during printing. The paper was exposed partly with a blurring filter, partley without. This gives the effect of dark tones bleeding into the lighter ones. One of many paths I tried and that illustrates the (overdone) result:

magick in.png -negate ( +clone -blur 15x7 ) -compose Lighten -composite -negate out.png

One other path I thought of was a variable blurring radius, or sigma, depending on the density of the current pixel. I have no clue how to acheive that.

To illustrate my line of thought:
magick in.png ( +clone -blur [map density 0-1 to radius 15-0]x7 ) -compose Lighten -composite out.png

TIA,

ingo

(ImageMagick 7.0.8-42 Q16 x64 2019-04-24 win10)

Re: blur variable radius

Posted: 2019-05-01T06:56:37-07:00
by snibgo
ingo wrote:One other path I thought of was a variable blurring radius, or sigma, depending on the density of the current pixel. I have no clue how to acheive that.
The required magick is "-compose Blur". I show examples at Selective blur.

See also related topics:

Soft focus: spreading the light
Adaptive blur and sharpen
Adaptive contour blur and sharpen

Re: blur variable radius

Posted: 2019-05-01T09:28:04-07:00
by ingo
snibgo wrote: 2019-05-01T06:56:37-07:00 The required magick is "-compose Blur". [...]
and use the original image also as (inverted) mask, I guess?

ingo

Re: blur variable radius

Posted: 2019-05-01T09:54:57-07:00
by snibgo
Yes. The blur is greatest where the mask is lightest. If you want the opposite, negate the mask. For example, using the input image as the mask:

Code: Select all

magick toes.png -sigmoidal-contrast 5x50% ( +clone ) -compose Blur -set option:compose:args 5x5 -composite compbl.jpg
Image

Negating the mask:

Code: Select all

magick toes.png -sigmoidal-contrast 5x50% ( +clone -negate ) -compose Blur -set option:compose:args 5x5 -composite compbl2.jpg
Image

Re: blur variable radius

Posted: 2019-05-01T10:21:45-07:00
by ingo
Insightful, thanks,

ingo