Page 1 of 1

Filter for a fuzzy border?

Posted: 2017-02-09T07:35:30-07:00
by AliceWonder
In The GIMP - I can open an image, in the Decor menu there is a "fuzzy border" filter.

You can specify a color, the border size, how much blur there is, whether or not to add a shadow.

When I look what it does, it creates a layer that is transparent in the middle, and has a border of specified color and dimension but is "fuzzy" on the inside edges of the border. I never use the drop shadow feature.

How do I do the same in ImageMagick from command line? It seems like it is probably straight forward, but I haven't found the syntax on http://www.imagemagick.org/Usage/crop/ which is where Bing sends me when I search.

ImageMagick-7.0.3.9

Thanks for suggestions

Re: Filter for a fuzzy border?

Posted: 2017-02-09T08:32:41-07:00
by Bonzo

Re: Filter for a fuzzy border?

Posted: 2017-02-09T09:17:41-07:00
by GeeMack
AliceWonder wrote: 2017-02-09T07:35:30-07:00You can specify a color, the border size, how much blur there is, whether or not to add a shadow. [...] I never use the drop shadow feature.
There are several ways to approach this. Using IM7 from a Windows command prompt, something like this would give you the result you describe...

Code: Select all

magick input.png -gravity center -bordercolor none ( -clone 0 -fill #804020 -colorize 100 ) ^
   ( -clone 0 -fill black -colorize 100 -shave 30 -border 30 -blur 0x8 ) -swap 0,1 -composite result.png
Inside the first parentheses it makes a copy of the input image. Then the "-fill ..." and "-colorize 100" change it to whatever you choose for a the frame color.

Inside the second parentheses it makes another copy, turns it black, shaves it to the size you want for the "hole", and blurs the edges of that. The "-shave ..." and "-border ..." operations determine the width of the frame. The "-blur ..." determines how much blur you have on the edges.

Now you have a stack of three images, the original input, the solid colored copy for the frame, and the shaved and blurred copy to use as a mask.

Next the "-swap 0,1" makes the first and second layers trade places so they're in the right order for the composite.

Finally the "-composite" lays down the frame color then the input image then the mask. The top layer, the mask, determines which part of the input image shows.

My code above is in Windows syntax. For a Unix shell you'd need to change that continued line caret "^" to a backslash "\", and probably escape all the parentheses with backslashes like "\(" and "\)", too.

Re: Filter for a fuzzy border?

Posted: 2017-02-09T12:52:05-07:00
by fmw42
What is your platform? If Unix-like, then see my scripts: bordereffects, bordergrid and imageborder for other border-like effects. I do not have this one, but GeeMack has given you a command for that which can be converted to unix syntax by replacing ( ... ) with \( ... \) and his new line ^ with \

Re: Filter for a fuzzy border?

Posted: 2017-02-09T13:35:48-07:00
by AliceWonder
Thanks. Yes I am on *nix, will be trying it shortly.