Nodes/comfyui-AGSoft/🖼️AGSoft RGBA to RGB
ComfyUI Node

🖼️AGSoft RGBA to RGB

What AGSoft RGBA to RGB Is Actually For

By Art-xmaster·Created about a year ago·Updated 2 days ago· 32
🖼️AGSoft RGBA to RGB
  • image
  • rgb_image

The failure that sends you here

Nothing in ComfyUI stops you from plugging a four-channel image into a node that has only ever thought in three. Both sockets say IMAGE. The link validates. The graph looks fine. Then you hit Run and get a stack trace out of torch.cat, or - worse - an output that renders but looks subtly wrong and you spend an hour blaming the checkpoint.

AGSoft RGBA to RGB exists for that moment: hand it any IMAGE, and it throws away the alpha if there is one and gives you plain three-channel RGB.

It's a shape adapter, not a creative tool, which is why almost nobody writes about it. The pack behind it - comfyui-AGSoft, 100-odd nodes from one author, still shipping as of October 2026 - is more personal toolbox than celebrated suite.

Why channel count is a runtime problem, not a graph problem

In ComfyUI, IMAGE is a torch tensor laid out [B, H, W, C], and channel count isn't part of the type system. Three-channel and four-channel tensors are both "an IMAGE" as far as the wires care, so the mistake is never caught where you make it - only downstream, by whichever node happens to assume something.

Core nodes aren't consistent about it either: some slice to the first three channels internally and the stray alpha sails through, others concatenate two tensors and break loudly. You're always guessing which kind you're about to feed - that's the argument for having a node like this.

Where four-channel images come from

You didn't ask for RGBA - something handed it to you:

  • Background removal and matting nodes, which work in alpha by definition.
  • LayerDiffusion-style transparent generation, and the newer alpha-video models - those pipelines carry a fourth channel the whole way through.
  • Loaders that preserve alpha instead of splitting it off into a mask.
  • Stitching or batching mixed inputs. The pack's own Image Stitch Plus says so in a code comment: it finds the maximum channel count across the list and pads every tensor up with ones, because otherwise "an RGBA file at index >=2 leaves earlier tensors at 3 channels, and torch.cat in stitch_grid crashes." One RGBA file in a folder can quietly make a whole stitch output four-channel.

How it works

Open the source and it's almost disappointingly small, which I mean as a compliment.

Everything goes through one validation pass: a [B,H,W,C] batch is accepted, a single [H,W,C] image is unsqueezed into a batch of one, 2-D and 5-D tensors are rejected. uint8 is divided by 255, other integer dtypes refused, and the channel count must be 1, 3 or 4 - anything else raises a bilingual error naming the count it got.

Then it's three branches: four channels becomes image[..., :3], three channels passes through untouched, one-channel grayscale is repeated into R=G=B. Output is contiguous float, batch and resolution exactly as you supplied. No colour management, no gamma, no premultiply.

The input and the output

One required input, image (IMAGE), one output, rgb_image (IMAGE). Nothing to configure - no "composite over this colour" dropdown, no tolerance, no mode switch.

Wire it into whatever choked: a batching node, a third-party filter that asserts three channels, a ControlNet preprocessor, or straight into Save Image.

Install

Easiest is ComfyUI Manager: search comfyui-AGSoft (publisher id agsoft), install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
pip install -r comfyui-AGSoft/requirements.txt

Restart, then find it under AGSoft/Image or type "RGBA" in the node search.

Declared dependencies are numpy, opencv-python and translators - but the conversion file imports only torch and logging, so it keeps working even if translators went sideways. The pack's __init__.py imports each file separately and logs failures per module instead of taking the whole suite down, which is a genuinely nice choice in a hundred-node pack.

Where people get burned

Dropping alpha is not compositing. Fully transparent pixels keep whatever RGB sat underneath - often black, sometimes noise. Need the subject on white instead of nothing? Composite first: Load Image hands you alpha as a MASK, ImageCompositeMasked lays the cutout over a blank image, then run this on the result. Core's Split Image with Alpha keeps alpha as a mask.

Its sibling can't put alpha back. Pairing this with AGSoft RGB to RGBA round-trips the channel count, not the transparency - alpha returns as solid 1.0.

The validation errors are correct. "Expected 1, 3, or 4 channels, got 2" means the tensor upstream really is odd. Don't fight the node; go look at what's producing the image.

If the node isn't in the menu, it's a pack-level install problem. Restart and read the console - the loader names every module it couldn't import, usually opencv or translators missing from ComfyUI's Python environment.

CategoryAGSoft/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGEComfyUI IMAGE tensor [B,H,W,C]. A single image [H,W,C] is also accepted. Standard RGB has 3 channels; RGBA has 4 channels. --- Тензор ComfyUI IMAGE [B,H,W,C]. Одиночное изображение [H,W,C] также принимается. Стандартный RGB имеет 3 канала; RGBA — 4 канала.

Outputs (1)

NameTypeDescription
rgb_imageIMAGER