RC Channel Extractor
Pull any channel out as a mask — the keying workhorse
- image
- IMAGE
- MASK
Compositing is half matching colors and half cutting things out, and cutting things out in ComfyUI usually comes down to masks. RC Channel Extractor is one of those quiet nodes that makes mask workflows dramatically easier: it takes an image and pulls any single channel - red, green, blue, alpha, or luminance - out as both a grayscale image and a mask.
The headline use is green screen. A green screen subject's green channel is a near-perfect alpha matte already: the screen is bright green, the subject is everything else. Extract the green channel, threshold it, and you've got a key. That's why "green" is the default and why the tooltip calls it "often best for green screen."
How it works
Mechanically it's a slice: for RGB it takes one color plane; alpha pulls the alpha channel (if the image has one); luminance computes the classic weighted grayscale (0.299·R + 0.587·G + 0.114·B). The invert toggle flips the result, so a white-subject-on-black plate becomes a black-subject-on-white mask, or a green-screen matte flips from "screen = white" to "screen = black" depending on which polarity your downstream mask node wants.
The dual output is the useful part: you get an IMAGE (the grayscale channel, if you want to see it or feed it to a node that wants images) and a MASK (the same data as a ComfyUI mask, ready to wire into any mask input - a compositor, an inpainting pass, a blur with a mask, you name it).
The inputs that matter
- image - input tensor.
- channel - red, green, blue, alpha, or luminance.
- invert - flip the polarity.
That's the whole node. It's a utility, and it knows it.
How to install it
Ships with the RC Image Compositor pack:
cd ComfyUI/custom_nodes
git clone https://github.com/kj863257/ComfyUI_RC_Image_Compositor
cd ComfyUI_RC_Image_Compositor
pip install -r requirements.txt
Restart ComfyUI, or search "RC Image Compositor" in ComfyUI Manager. Deps: pillow, numpy, opencv-python.
Common issues
The honest limitation: a raw channel is a starting matte, not a finished key. Real green-screen footage has spill, soft edges, and uneven lighting, so the raw green channel will have gray halos. Plan to run the extracted mask through a levels or threshold node (the pack has RC Levels) and possibly a blur or feather before it's clean enough to composite with.
Second, remember alpha only exists if your input actually carries one - a plain 3-channel RGB tensor has no alpha to extract, and you'll get an empty or default mask. Load with an alpha-preserving loader for that.
And a pro move: luminance extraction is great for building luminance masks - the classic "apply this grade only to the brights" trick. Extract luminance, invert it, and you have a highlight mask for free. That single pattern justifies the node even if you never touch a green screen.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| channel | COMBO | green | Channel to extract: - red: Red channel - green: Green channel (often best for green screen) - blue: Blue channel - alpha: Alpha channel (if available) - luminance: Luminance (0.299*R + 0.587*G + 0.114*B) |
| invert | BOOLEAN | false | Invert the extracted channel |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |