Nodes/comfyui-sunflower-nodes/Mask Channel Select
ComfyUI Node

Mask Channel Select

Pull any channel out of an image as a mask

By andygill·Created 2 years ago·Updated 6 months ago· 1
Mask Channel Select
  • image
  • MASK
channelRed

ComfyUI's mask type is a single-channel grayscale thing, and images are four channels wide. Sometimes the thing you actually need is hiding in one of them - a depth or disparity map stored in the Red channel, an alpha matte, or one slice of a "channel-packed" image (packing multiple maps into a single RGB image to save memory is a real pattern). MaskChannelSelect just peels off the channel you name and hands it to you as a MASK.

Give it an image, choose Red, Green, Blue, or Alpha, and out comes that channel as a mask. That's the entire node. It's a utility, and it's the right shape for one - no knobs to fiddle with, no surprises, does one thing.

When you'd reach for it: grabbing the red channel of a render that stashes depth in Red to feed a mask-based pipeline (including, plausibly, the disparity input of this pack's own DisparityToDepthView, since disparity is grayscale anyway), extracting an alpha matte from a PNG for compositing, or splitting a channel-packed map into its parts before using them.

One trap is worth naming up front: the alpha gotcha. If your image has no transparency, its alpha is a flat 1.0, so Alpha returns an all-white mask - not a bug, just what "no alpha" means. If you expected a shape and got a blank white rectangle, that's it. Also remember you're getting a channel's brightness, not a region - pull Red from a photo and you get the red-ish areas as bright values, which is probably not a mask of a subject. For selecting whole regions (left half, right half, top, bottom) use the sibling ImageChannelSelect instead; that's what it's for.

It comes from andygill's comfyui-sunflower-nodes, a small 3D-visualization pack with no models and no extra dependencies. Install via ComfyUI Manager - search comfyui-sunflower-nodes - and restart, or clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/andygill/comfyui-sunflower-nodes

Then restart ComfyUI. Caveat, same as the rest of the pack: the repo has been quiet since spring 2025 and is currently offline, so if the clone 404s, an archived copy drops into custom_nodes and works identically.

Categoryimage/transform

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
channelCOMBORed4 options: Red, Green, Blue, Alpha

Outputs (1)

NameTypeDescription
MASKMASK