Image Alpha Split
Get your alpha back without wrecking the RGB
- image
- image
- mask
If you've ever fed an RGBA cutout into an image-edit model or a VAE and gotten weird halos or flat gray mush where the transparency was, you know the pain. Image Alpha Split is the fix: it takes a transparent image, flattens it onto a solid background you pick, and hands you the alpha channel back as a proper MASK. Two outputs, one node, and it solves a class of annoying problems.
This ships in ComfyUI 1hewNodes, a big utility grab-bag by solo dev 1hew. It's a personal toolkit made public - bilingual EN/中文 README, an active v3.x changelog, and no reddit footprint to speak of, so treat the docs as the source of truth. For this node there's no model, no API, nothing to download beyond the pack.
How it works
The math is just premultiplied compositing: rgb * alpha + background * (1 - alpha) per pixel. That's the same thing Photoshop does when you flatten a layer. The useful part is that it does it on a color you control - default 1.0 (white) - and it emits the alpha as a mask alongside the flattened image.
The color parser is friendlier than most: 1.0 or 0 for grayscale, 255,0,0 or 1.0,0,0 for RGB, #ff0000, or even names like green and magenta. If your input is already opaque RGB it just passes through with an all-white mask, so this node never surprises you by inventing alpha.
The inputs that matter
- image - any IMAGE; handles 1, 2, 3, or 4 channels.
- background_color - the color transparent pixels flatten onto. Default
"1.0"(white). This one matters more than it looks: it's your halo-control knob.
Outputs are image (flattened, no alpha) and mask (the extracted alpha). Wire the flattened image into anything that wants clean RGB - a Qwen-Image-Edit style editor, a sampler, an upscaler - and keep the mask for the compositing step later. That "composite the mask region back so nothing else moved" trick from the inpainting playbook is exactly what this pair of outputs is built for.
Installing it
ComfyUI Manager: search "1hew" or "ComfyUI 1hewNodes" and install. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Then restart ComfyUI. The pack's requirements list pulls in a lot (opencv, scikit-image, scikit-learn, and heavier things like ultralytics and rembg for its other nodes), so first install can take a while even though this node only really needs numpy + Pillow. No model files are downloaded for it. One gotcha: the pack is built on the modern ComfyUI node API (comfy_api.latest), so an old ComfyUI build won't register it - update ComfyUI if nodes show up missing.
Where people get burned
The classic mistake: flattening onto white when you're going to composite the cutout over something dark. You get a white fringe that's invisible in the split view and catastrophic in the composite. Pick background_color to match wherever you'll put the subject. And remember this node can't conjure alpha from an opaque image - if your source is a flat RGB JPEG, the mask comes out all-white. Feed it something with real transparency (a matted cutout from a background-removal node) and you're in business.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| background_color | STRING | 1.0 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |