Hello everyone,
First of all, know that I'm relatively new using C++ language and it's my first time trying to code using magick++ library, so I'm a real beginner.
I have a series of picture like this one :
where only the part inside the hexagon changes.
Now what I would like to do :
- Between the circle and the hexagon I would like to change the color from blue to something else ( green or red for example)
- I would like the blue color outside the circle to be white
Do you have any idea / advice how I could do that ? thank you !
Color Filling
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color Filling
Sorry, I do not use C++, but the command line that you want to emulate in C++ is:
I manually picked one pt outside the circle and one point between the circle and the hexagon. Then used color flood fill to replace the blue color in those two places with white and red.
See
http://www.imagemagick.org/Usage/draw/#color
If your blue colors in other images are not uniform, then you can add -fuzz XX% to allow colors that are similar to be replaced.
Code: Select all
convert hexagon_circle.png -fill white -draw "color 5,5 floodfill" -fill red -draw "color 165,20 floodfill" -alpha off hexagon_red_circle_white.png
I manually picked one pt outside the circle and one point between the circle and the hexagon. Then used color flood fill to replace the blue color in those two places with white and red.
See
http://www.imagemagick.org/Usage/draw/#color
If your blue colors in other images are not uniform, then you can add -fuzz XX% to allow colors that are similar to be replaced.