Selective floodfill

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
unhappycamper

Selective floodfill

Post by unhappycamper »

I have many square-shaped images that are black and white, but have a rounded white border on each corner. I want to fill in those borders with black. So I'm wondering if there is a way to selectively floodfill only those four areas. Any insight would be appreciated.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Selective floodfill

Post by GreenKoopa »

-floodfill? Posting the image would help me see what you are describing.
unhappycamper

Re: Selective floodfill

Post by unhappycamper »

Thanks for your reply. I just figured out how to do it, with a composite command (with bumpmap).
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Selective floodfill

Post by anthony »

An example would have helped...

Try -fuzz 1% -fill black -floodfill +0+0 white
and repeat the flood fill on each corner pixel.

This floodfill will only floodfill white corners and will ignore non-white corners.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
unhappycamper

Re: Selective floodfill

Post by unhappycamper »

Yes, sorry, I just joined and wasn't sure how to post an image to the forum.

Here is what worked for me (before your suggestion):
composite 44.jpg inverted.jpg -compose bumpmap -gravity center 44_inverted.jpg

(inverted.jpg being the basic black and white image, inverting black and white, so that the corners were now black)

That command left some lines, so I just edited the inverted file to make sure the black bled into the image some more. And then ran it again, and it worked perfectly.

Thanks again for your suggestion.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Selective floodfill

Post by fmw42 »

You need to find some free image hosting service, upload your image there. Then put a link here to that image. This forum does not allow direct upload of images.
Post Reply