Light-Tool: RGBa To RGB
Flattening RGBA to RGB — and what you're actually losing
- image
- image
ComfyUI is picky about channels. Some models, some VAE encodes, and a lot of save/export paths assume your image tensor is three channels, and feeding them a four-channel RGBA tensor is a one-way ticket to "shape mismatch" errors or silently wrong output. Light-Tool: RGBA2RGB is the three-line fix: drop the alpha channel and hand you a plain RGB image.
At its heart it's a single Pillow .convert("RGB") call run per image in your batch and re-stacked into a tensor. Nothing fancy, and that's exactly why it's worth having - it's the kind of tiny utility that would be annoying to rebuild by hand inside a graph.
The one thing people misunderstand
Here's the trap: converting RGBA to RGB does not composite the image onto a background. Pillow just discards the alpha channel, keeping whatever RGB values were stored in the pixels underneath. For fully opaque images - most model output - that's a no-op, visually identical, and totally fine.
But for partially transparent pixels, what's "underneath" the alpha is often garbage: black, or whatever was in the buffer when the image was built. The classic symptom is a cutout that looked fine in a viewer suddenly going dark or muddy after the conversion. If you've got real transparency and you want it gone properly, you want Light-Tool: AddBackground instead, which composites over a solid color. Use this node when the image is effectively opaque and you just need the channel count to match. Use AddBackground when transparency actually matters.
Inputs and output
The input set is gloriously small: one image tensor. The output is one image tensor, now RGB, which you can wire into anything that demands three channels - and the node keeps the batch size intact, so a stack of images in, a matching stack out.
A note on the sibling
The pack also ships Light-Tool: RGB2RGBA for the opposite direction (adding an alpha channel), which pairs nicely when you need to hand an opaque image to a node that expects RGBA. Between the two, you can normalize channel counts anywhere in a graph without reaching for a compositing node.
Install and context
Same as the rest of the pack: ComfyUI Manager → search ComfyUI-Light-Tool, or clone into custom_nodes and pip install -r requirements.txt, then restart. It's part of a grab-bag pack by GitHub user ihmily (small but actively maintained, MIT-licensed) that shows up in community workflows whenever someone needs quick image and mask plumbing. No models, no downloads - this node is just Pillow doing its one job.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |