AlphaChanelAsMask
Pull the alpha channel out as a usable mask
- images
- MASK
AlphaChanelAsMask extracts the alpha channel from an RGBA image and hands it back as a MASK tensor - the reverse of AlphaChanelAddByMask. If you've cut out a subject with a background-removal node and now want to reuse that transparency as a selection for inpainting, conditioning, or a second composite, this is the node that does it. Same one-L "Chanel" spelling as the rest of the family, so search for that or you'll find nothing.
The inputs are images (IMAGE) and a method dropdown: default or invert. Because ComfyUI masks use white (1.0) for "keep/selected," and an alpha channel uses 1.0 for "opaque," the polarities are swapped relative to what you might expect:
- default - outputs
1 − alpha. Opaque areas become black, transparent areas become white. This matches the mask semantics most downstream nodes expect: the cut-out region is where you want to not mask. - invert - outputs the alpha directly. White where the image is opaque, black where it's transparent.
If the mask seems reversed in whatever node you feed it into, flip method and move on - that's the whole calibration knob this node has.
Two hard constraints worth knowing before you build around it:
- It needs an alpha channel to exist. Feed it a plain RGB image and it raises an error - literally "Alpha chanel not exist." Run AlphaChanelAdd first if you need to guarantee one.
- It only reads the first image in the batch. The implementation grabs
images[0], so a 30-frame animation's alpha won't all come through - you'll get frame one's mask. For single stills (the common case here) it's a non-issue; just don't feed it a video strip and expect per-frame masks.
Output is a MASK tensor, which you can wire straight into ComfyUI's masking, inpainting, or conditioning machinery.
Installing it
It ships with the Allor plugin:
cd ComfyUI/custom_nodes
git clone https://github.com/Nourepide/ComfyUI-Allor
cd ComfyUI-Allor
pip install -r requirements.txt
Restart ComfyUI, or install "Allor" via ComfyUI Manager. Pack-level notes: requirements.txt installs rembg and onnx for the segmentation nodes even though this node is pure tensor math, and Allor's repo was rebased to strip images from git history - if auto-updates start failing, the docs at nourepide.github.io/ComfyUI-Allor-Doc have troubleshooting pages for exactly that.
Real talk
This is the quiet workhorse of the alpha family and probably the most useful of the five. Cut out a subject, pull its alpha into a mask, and suddenly every mask-driven node in ComfyUI - inpainting, ControlNet conditioning, targeted effects - can operate on exactly the region you already isolated. The two gotchas (no alpha = error, batch = first frame only) are sharp edges you'll hit exactly once. Everything else is a polarity flip away from working.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| method | COMBO | 2 options: default, invert |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |