Mask
Pull a red, green, blue, or alpha channel out of an image
- MASK
Mask is the rare node in the ComfyUI-CUP pack that actually does something useful on its own, with no Blender in sight: it takes an image file and extracts a single channel - alpha, red, green, or blue - as a ComfyUI MASK tensor. Simple, boring, and genuinely handy.
Channel-to-mask extraction is a workhorse trick in image pipelines. Selection masks stored in an image's alpha channel, mattes hidden in a green channel, channel-packed data (the classic way to stash a mask inside an RGB image) - Mask lets you pull any of those out and use it to drive inpainting, compositing, or conditioning. If you've ever had a workflow that expected a MASK but you only had an image file, this node is the missing adapter.
How it works
- image (STRING) - a path to the image file on disk. Not a tensor input; it opens the file directly.
- channel (enum) - which channel to extract:
alpha,red,green, orblue.
Output: a single MASK tensor, normalized to 0–1. One detail worth knowing: the alpha channel comes out inverted (1 - alpha), so that opaque areas - which have alpha = 1 - become mask value 0, matching ComfyUI's convention where white (1) means "this region is masked/interpolated." The RGB channels come out as-is.
Like most of CUP, it's forgiving to the point of being dangerous: if the file doesn't exist, or the requested channel isn't in the image's bands (asking for red on a grayscale PNG, for example), you don't get an error - you get a 64×64 mask of zeros. Fine for a graceful fallback, maddening when you're debugging why a mask silently does nothing.
Install
Ships with ComfyUI-CUP. ComfyUI Manager → search ComfyUI-CUP, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AIGODLIKE/ComfyUI-CUP.git
Restart after. No extra dependencies or model files.
The honest assessment
Unlike the OpenPose loaders in this pack, Mask isn't glued to the Blender bridge - it works in a plain web workflow the moment you give it a file path. It's a genuinely useful little utility, the kind you'll add to a few workflows and forget you have. Just don't feed it a directory or a nonexistent path expecting an error message to guide you; the pack's design philosophy is "return zeros and move on."
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | STRING | — | |
| channel | COMBO | 4 options: alpha, red, green, blue |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |