Page 1 of 1

how to blur circle edges inside and not outside ?

Posted: 2014-08-20T00:05:22-07:00
by ravikum
Hello,

I have a black circle on white background. (or any other colors)
i want to blur the edges of the circle.
So, I want the radius of the blurred circle not to increase.

when we use

Code: Select all

input -blur 0x8 output
I think it blurs outside.

Is it possible to blur inside and not outside?

Please suggest.
Thanks

Re: how to blur circle edges inside and not outside ?

Posted: 2014-08-20T00:52:03-07:00
by snibgo
You can mask the effect, so the result inside the circle is from the blur, and the result outside the circle is from the image before the blur. Eg Windows BAT script:

Code: Select all

%IM%convert ^
  -size 200x200 xc:White ^
  -fill Black -draw "circle 100,100 100,50" ^
  ( -clone 0 ^
    -blur 0x20 ^
  ) ^
  +swap ^
  -clone 1 ^
  -composite ^
  c.png

Re: how to blur circle edges inside and not outside ?

Posted: 2014-08-20T01:51:55-07:00
by ravikum
Hi,
thanks for your reply.

I tried to implement your code.
Image
In this image, first one is original circle.
second circle is what I got using your code.
Third is like what I want, but this got a bigger radius [ using the code -blur 0x20 ]

Using your code, the circle doesn't merge with the background like the third image.

Is there any way to achieve like the third image with the radius like the first one?

Please suggest.
Thanks.

Re: how to blur circle edges inside and not outside ?

Posted: 2014-08-20T02:07:15-07:00
by snibgo
You could start with a smaller circle. Or level the image:

Code: Select all

convert ^
  -size 200x200 xc:White ^
  -fill Black -draw "circle 100,100 100,50" ^
  -blur 0x20 ^
  -level 0,50%% ^
  c2.png

Re: how to blur circle edges inside and not outside ?

Posted: 2014-08-20T02:19:48-07:00
by ravikum
Thanks a lot snibgo
This code worked perfectly.
You saved me!