Page 1 of 1

Area detected by Color Fill Primitives

Posted: 2010-01-21T09:15:59-07:00
by GregUK
Hi all

I'm using the following to fill the area surrounding a given pixel with a particular colour:

Code: Select all

convert input.jpg -fill red -fuzz 10% -draw "color 10,10 floodfill" output.jpg
This works great, but I am now looking for a way to draw a filled polygon over the detected colour area, rather than simply flood-filling it. Is it possible to get the location of the points bounding the detected area to pass into -draw polygon?

Many thanks
Greg

Re: Area detected by Color Fill Primitives

Posted: 2010-01-21T10:56:08-07:00
by fmw42
As far as I know IM has no direct built in method. But Anthony came up with a combined technique. see http://www.imagemagick.org/Usage/transform/#edge_vector

Re: Area detected by Color Fill Primitives

Posted: 2010-01-21T12:20:37-07:00
by GregUK
Thanks, I'll take a look at the SVG method.

I've just had another idea: Is it be possible to apply the result of the floodfill to a separate mask image rather than the source image? If so, how would I do this?

Re: Area detected by Color Fill Primitives

Posted: 2010-01-21T14:04:42-07:00
by fmw42