D2 Extract Alpha
Pull the alpha back out of an RGBA image (when there actually is any)
- image
- MASK
- IMAGE
D2 Extract Alpha is the flip side of the same coin as D2 Apply Alpha Channel. Wherever that node stamped a mask into the alpha channel, this one peels it back off. Feed it an RGBA image and you get two outputs: a proper ComfyUI MASK and the RGB image with the alpha stripped away.
It's the third node in da2el's D2-SavePSD-ComfyUI pack (April 2025, category D2/Image), and its real job is round-tripping. After you apply alpha for a PSD export, you extract it again to feed the mask into another part of the graph - an inpaint, a blend, a check that what you applied is actually what you meant. Small node, small pack, no models, no API.
The mechanism is a few lines of tensor work. The node looks at the input's channel count. Four channels? It grabs channel 3, converts the 0–255 greyscale values to a 0–1 float mask, and hands it back as the MASK output, with the RGB (alpha removed) as the IMAGE output. Three channels? There's nothing to find, so it returns a solid white mask and the image untouched.
Which brings us to the one thing that burns people, and the README states it outright: cannot separate alpha channels from transparent PNGs. That isn't a bug - it's ComfyUI's own decoding. The standard Load Image node reads PNGs into a 3-channel IMAGE tensor, so the transparent PNG you load from disk has already lost its alpha before this node ever sees it. Extract Alpha only ever finds alpha that exists inside the graph: the output of D2 Apply Alpha Channel, or RGBA from a transparency-generating pipeline like LayerDiffusion. Feed it a normal loaded image and you'll get that all-white mask, every time. It's the single most important thing to know about this node.
The two outputs:
- MASK - the extracted alpha as a normal mask, ready to wire into inpainting, compositing, or any mask-consuming node.
- IMAGE - the RGB with alpha removed, handy when you want a flat image to feed something that chokes on four channels.
Install
Same as the rest of the pack. ComfyUI Manager (search "D2-SavePSD-ComfyUI") or:
cd {ComfyUI}/custom_nodes
git clone https://github.com/da2el-ai/D2-SavePSD-ComfyUI.git
Then run python install.py from the pack folder - the README stresses this is required even after a Manager install, because the pack installs its deps (psd-tools, scikit-image) through a custom script rather than a requirements.txt Manager runs for you. Light install: no model files, no GPU deps.
Common issues
- White mask on everything = the alpha was dropped upstream, almost always by a save/load round-trip or a node that outputs plain RGB. Keep Apply → Extract in the same graph.
- Want masks out of transparent PNGs on disk? This node can't invent what ComfyUI discarded. You'd need a loader that preserves alpha into an RGBA tensor first - and that's a different tool entirely.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |
| IMAGE | IMAGE | — |