blur variable radius

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
ingo
Posts: 3
Joined: 2019-05-01T06:03:52-07:00
Authentication code: 1152

blur variable radius

Post 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)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: blur variable radius

Post 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
snibgo's IM pages: im.snibgo.com
ingo
Posts: 3
Joined: 2019-05-01T06:03:52-07:00
Authentication code: 1152

Re: blur variable radius

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: blur variable radius

Post 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
snibgo's IM pages: im.snibgo.com
ingo
Posts: 3
Joined: 2019-05-01T06:03:52-07:00
Authentication code: 1152

Re: blur variable radius

Post by ingo »

Insightful, thanks,

ingo
Post Reply