In ImageMagick, -channel does not work to select channels from multiple images.
Furthermore and more importantly, white contains red, green and blue. So the red channel of the first image will have the red dot as white and the background white as white, leaving black for the green and blue lines. Similarly in the other images. So white needs to be made black in each image. Then the channels are separated and recombined. Then black needs to be made white again.
Unix syntax:
convert \
\( image01.png -fuzz 70% -fill black -opaque white \
-channel r -separate +channel \) \
\( image02.png -fuzz 70% -fill black -opaque white \
-channel g -separate +channel \) \
\( image03.png -fuzz 70% -fill black -opaque white \
-channel b -separate +channel \) \
-set colorspace sRGB -combine \
-fuzz 20% -fill white -opaque black \
result.png
convert.exe ^
( image01.png -fuzz 70% -fill black -opaque white ^
-channel r -separate +channel ) ^
( image02.png -fuzz 70% -fill black -opaque white ^
-channel g -separate +channel ) ^
( image03.png -fuzz 70% -fill black -opaque white ^
-channel b -separate +channel ) ^
-set colorspace sRGB -combine ^
-fuzz 20% -fill white -opaque black ^
result.png
The -fuzz is needed to remove the anti-aliased colors that are near white around the edges of the colored regions.
You would be much better starting with the 3 input images that have a black background rather than white. Then all the fuzz and white to black and black back to white would not be needed.
cmd.exe
has a different syntax than the Linux shell interpreters. So first replace all'
by"
because of'
has no special meaning forcmd.exe
in comparison to Linux shell interpreters. Second the directory separator on Windows is\
and not/
as on Linux and for that reason replace all/
by\
in the command line. CMD interprets,
as argument separator and replaces it by a space character, except the comma is inside an argument string enclosed in"
. Therefore'red,green,blue'
is something completely different than"red,green,blue"
. – Mofi