-fill Command Emulation with Magick++

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
Posts: 1
Joined: 2017-07-14T13:20:14-07:00
Authentication code: 1151

-fill Command Emulation with Magick++

Post by borjarojo » 2017-07-14T13:30:40-07:00

Hi all, new here, and I was wondering if you could help me out with a problem:

I want to take an image that I have and replace the alphas of the pixels that match a certain color, with a certain fuzz, with the value 0. That is, make all pixels that don't match a certain color clear using Magick++.

Right now, I have this command in a bash script:

convert \
\( $PICTURE +fuzz -fuzz $REDFUZZ -fill none +opaque red \) \
\( $PICTURE +fuzz -fuzz $GREENFUZZ -fill none +opaque green \) \
-composite -compose plus \

which allows me to take a picture and replace all the pixels that are not red or green, as individual commands, with clear alphas and then mash those two pictures on top of each other.

I want to do this programatically. Any ideas?

User avatar
Posts: 22105
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: -fill Command Emulation with Magick++

Post by fmw42 » 2017-07-14T14:59:31-07:00

I know nothing about Magick++ or any other API, but have you looked at colorFuzz and opaque at https://www.imagemagick.org/Magick++/Im ... %20Methods

Post Reply