Nodes/comfyui-lumi-tools/Lumi RGBA to RGB
ComfyUI Node

Lumi RGBA to RGB

Getting Rid of the Fourth Channel Without Breaking Your Graph

By illuminatianon·Created 11 months ago·Updated 5 days ago· 1
Lumi RGBA to RGB
  • image
  • image

The convention it exists to repair

ComfyUI's IMAGE type is a float tensor, 0–1, shaped [batch, height, width, 3]. Three channels, always. Alpha doesn't ride inside the image - it travels on the MASK wire, which is why Load Image hands you a separate mask output for a transparent PNG instead of an RGBA tensor.

Most of the time you never notice the rule. Then a node hands back four channels - a LayerDiffusion-style decode that produced alpha natively, a matting node, anything that opened a transparent PNG with PIL and forgot to call .convert("RGB") - and the next node in line, written against the three-channel assumption, either throws or quietly misbehaves.

This node is the fix. It drops the fourth channel and gives you a normal RGB image.

How it works

The whole mechanism, straight out of the source, is one slice:

image[..., :3]

Before that it checks the tensor is rank 3 ([H, W, 4]) or rank 4 ([B, H, W, 4]) with a last dimension of exactly 4, and raises a ValueError printing the shape it actually received if not - the most useful part of the node when something goes wrong.

Two things it doesn't do, and both are traps:

  • It doesn't turn alpha into a mask. The fourth channel is discarded. If you wanted the cutout, you wanted a different node.
  • It doesn't composite. Whatever RGB was sitting under the transparent pixels becomes your image - often black, sometimes a fringe of whatever the matting model invented at the edge. Dropping alpha is not the same as flattening onto white.

Plumbing like this is most of any workflow - invisible right up until a wire won't connect.

Inputs and outputs

There is one of each, and nothing to configure:

  • image (required, IMAGE) - the RGBA tensor you want flattened to RGB.
  • output image (IMAGE) - the same pixels, three channels.

No widgets, no mode dropdown, no mask output. Wire it between the node producing four channels and the node that can't eat them: Lumi RGBA to RGB → VAE Encode, → Save Image, → upscaler. It's registered under Lumi/image, and it supports both of ComfyUI's node APIs, so the wiring is the same on old and new frontends.

Installing it

It ships with the pack - install once, get all sixteen nodes.

ComfyUI Manager: search for Lumi Tools (publisher illuminatianon-333), install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/illuminatianon/comfyui-lumi-tools

then restart and look for Lumi RGBA to RGB under Lumi/image.

One packaging gotcha. The pack declares its dependencies in pyproject.toml (dynamicprompts and requests) and there's no requirements.txt, so a bare clone won't pull them and Manager-style auto-install has nothing to read. Neither is used by this node - it imports torch and, optionally, ComfyUI's comfy_api.latest - but the pack imports everything at load time, so a missing dynamicprompts takes the whole pack down with it:

cd ComfyUI/custom_nodes/comfyui-lumi-tools
pip install dynamicprompts requests   # into the same env ComfyUI runs from

The README's uv sync is right if you're developing the pack, but it makes a .venv inside the pack folder that ComfyUI isn't using. As a user, pip into ComfyUI's environment.

Troubleshooting

Expected an RGBA IMAGE tensor with shape ... got (1, 1024, 1024, 3) - your input already is RGB. Take the node out. If the last number is 1 rather than 3, something handed you a single-channel tensor (usually a mask dressed up as an image) and this node will refuse it rather than guess.

You searched the error and found expected input to have 3 channels, but got 4 channels instead - check what's wrong before blaming alpha. In the threads that error comes from, it's usually a latent/VAE mismatch, not an RGBA image.

Transparent areas went black - expected. You threw away the information that said "don't draw here." Composite onto a background first, or keep the alpha and use it.

You wanted the mask, not the RGB - go back to the node that produced the transparency; most matting nodes have a MASK output, and the pack's own Lumi Load Image does this properly, converting to RGB and emitting inverted alpha as a mask. This node is the escape hatch for when a node gave you RGBA and nothing else. Not in the menu after installing - restart. And don't trust the README's node list: it's stale and doesn't mention this node. If it's in the source but not the UI, the pack failed to import - scroll up for the traceback.

The verdict

It's a fuse. Boring, one job, no settings, exactly what you want when a graph is four-fifths built and one node refuses to take the wire. If you run LayerDiffusion on SDXL, or any matting node that emits RGBA, this is the least fiddly way back to something the rest of the graph accepts.

CategoryLumi/image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE—

Outputs (1)

NameTypeDescription
imageIMAGE—