Page 1 of 1

Dynamic blur command

Posted: 2017-02-22T04:24:32-07:00
by Videomajk
Hello

I'm trying to create a dynamic blur effect where the sigma value is dependent on other image value. I've tried this:

Code: Select all

-blur 0x%%[fx:h/400]
I understand from other posts that this is not supported by the blurr command. Is there Another way of achiving this effect?
My IM version is 6.9.7 on Win10.

Re: Dynamic blur command

Posted: 2017-02-22T07:10:43-07:00
by snibgo
The magick you need is "-compose blur".

See http://www.imagemagick.org/Usage/mapping/#blur and examples on my "Selective blur" page.

Re: Dynamic blur command

Posted: 2017-02-22T10:05:47-07:00
by snibgo
Correction to the above: I think I misunderstood what you want.

I now think you want a constant blur for a given image, a constant sigma, but that will depend on an expression, eg:

Code: Select all

magick toes.png -blur 0x%[fx:h/400] b.png
This works in v7, but is not available in v6.

For v6, you can first calculate the sigma as an environment variable:

Code: Select all

for /F "usebackq" %L in (`identify -format "SIG=%[fx:h/400]" toes.png`) do set %L

convert toes.png -blur 0x%SIG% b.png
If using BAT files, don't forget to double the % signs as required.