Compose RGBA Image From Mask
Compose RGBA Image From Mask (ComposeRGBAImageFromMask) — ComfyUI-LogicUtils
- image
- mask
- IMAGE
This is the node that makes transparent PNGs. You give it a color image and a mask, and it staples the mask onto the image as its alpha channel, producing an RGBA image where the mask decides what's visible and what's see-through. If you've done any background removal or cutout work, this is the step that turns "here's the subject and here's where it is" into an actual image with a transparent background.
That's a common need and ComfyUI doesn't make it obvious. A background remover or a segmentation model hands you a mask, but a mask on its own isn't a transparent image, it's a separate grayscale channel sitting off to the side. Compose RGBA From Mask is the join: image plus mask in, one RGBA image out, ready to save as a PNG that keeps its transparency. Sticker-style assets, product cutouts, overlays for compositing, they all pass through an operation like this.
It ships in ComfyUI-LogicUtils, aria1th's utility pack. aria1th is AngelBottomless, the trainer behind Illustrious XL, and the pack is his personal toolbox, so the node is lean and undocumented, but the job it does is clear enough once you see the inputs.
Inputs and outputs
Three required inputs. image is the IMAGE that becomes the color (RGB) part. mask is the MASK that becomes the alpha channel. invert is a BOOLEAN that flips the mask, swapping which regions are transparent and which are opaque. The single output is an IMAGE, now with four channels: the color plus the alpha you just attached.
The invert toggle is the one you'll actually touch. Masks come out of different upstream nodes with opposite conventions about which side is "the subject," so if your transparency comes out backwards, flipping invert is almost always the fix.
Installing it
- ComfyUI Manager: Custom Nodes Manager, search "ComfyUI-LogicUtils," install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/aria1th/ComfyUI-LogicUtils, then restart.
No models, no heavy dependencies. The pack's optional auto-installer is off unless you set COMFYUI_LOGICUTILS_AUTO_INSTALL=1 (force off with COMFYUI_LOGICUTILS_SKIP_INSTALL=1), and compositing a mask into alpha needs none of it.
Getting a clean result
Two things trip people up. First, the inverted mask, covered above: if the wrong half is transparent, toggle invert. Second, and this catches everyone at least once, the transparency only survives if you save the result properly. Wire this into a save that writes PNG with the alpha channel intact. If you send an RGBA image through a node that flattens it back to RGB, or through a converter like ConvertRGB in this same pack, you throw the transparency away and wonder where it went. Keep it RGBA all the way to disk.
Get those two right and the output is exactly what you wanted: a clean cutout with a genuinely transparent background, not a subject pasted onto white.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| invert | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |