Page 1 of 1

Add border around selection

Posted: 2017-02-26T23:47:49-07:00
by kboehme1
OS: MacOS
Version: ImageMagick 7.0.5-0 Q16 x86_64 2017-02-21 http://www.imagemagick.org

I have an image that is a black outline on transparent background.
https://www.dropbox.com/s/6t9r4m408ljre ... e.png?dl=0

I would like to select all black color and add a 2 pixel red border around it.

https://www.dropbox.com/s/65udncxwuqmsp ... e.png?dl=0

Re: Add border around selection

Posted: 2017-02-27T01:17:58-07:00
by fmw42
Perhaps it would be best to upload your image to some free hosting service such as dropbox.com and put the URL here so we can fully understand your problem.

Re: Add border around selection

Posted: 2017-02-28T16:41:24-07:00
by kboehme1
fmw42 wrote: 2017-02-27T01:17:58-07:00 Perhaps it would be best to upload your image to some free hosting service such as dropbox.com and put the URL here so we can fully understand your problem.
Updated the question to include examples.

Re: Add border around selection

Posted: 2017-02-28T16:55:43-07:00
by fmw42
try this:

Code: Select all

convert shape.png \
\( -clone -0 -background red -flatten \) \
\( -clone -0 -alpha extract -morphology dilate diamond:2 \) \
-delete 0 -alpha off -compose copy_opacity -composite \
-background black -alpha background result.png

Re: Add border around selection

Posted: 2017-02-28T20:06:16-07:00
by kboehme1
That works great. Thanks!