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?".
identify.exe: iCCP: known incorrect sRGB profile `009.png' @ warning/png.c/MagickPNGWarningHandler/1830.
However, I don't understand your comment abot CMY. The first result shows the red channel. Where the input is green or blue the red channel shows black. Where the input is red or white the red channel shows white.
I think I misunderstand the function of "separate". What I want to do is to copy the RED pixels from the source image to the destination. (Also the GREEN and the BLUE ones as separate images). I mean, I want to obtain 3 grayscale images representing the RED, GREEN and BLUE channels of the source image.
But as I understand, "separate" eliminates the given channel from the source image.
I also tried the function compositeImage with the COMPOSITE_COPYRED parameter but the result was the same with the separate function.
"-separate" gives you the value that was in the red (etc) channel. The colour "red" has a value in just the red channel. The colour "white" has values in all three channels. What you want is black instead of white. Or rather, as your white is transparent, to flatten against black.
PNG does not support CMYK. So the image is sRGB. For other image types, such as jpg, if you want to convert from cmyk to rgb, the proper command is -colorspace sRGB and not -set colorspace RGB. The latter just changes the meta data tag for colorspace without changing the data.
Your input png could be 32-bit color, that is RGBA, so if you use -separate and get 4 output images, the last one may be alpha (transparency).
Setting the background color to "black" and flattening the image before separating the red (or any other) channel fixed the problem.
Transparent pixels of the image are in fact "white pixels with zero opacity" so they are included in every channel if I don't replace them with black ones before separating.
As I forgot that, I misinterpreted the resulting images.