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

🖼️AGSoft RGB to RGBA

Adding an Alpha Channel Won't Make Anything Transparent (AGSoft RGB to RGBA)

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

Let's kill the misunderstanding first

People search for "RGB to RGBA" hoping it's the transparency button. It isn't. This node staples a fourth channel onto a three-channel image and fills it with 1.0 - fully opaque, everywhere, always. The author says so flatly in the node description: this node does not create transparency. Want a cut-out? You need a matting or background-removal node, not this.

What you're getting instead is a shape adapter. And once you accept that, it's a genuinely useful little thing.

What it's actually for

ComfyUI's IMAGE type doesn't encode channel count, so a three-channel and a four-channel tensor are both legal IMAGEs and the mismatch only surfaces when a node tries to combine them. Two places that bites:

  • Something downstream insists on four channels - a compositing step, a video or texture pipeline, a third-party node that concatenates on its own assumptions.
  • You're batching images and one branch already came back RGBA. torch.cat on mismatched channel counts just fails.

The pack's own Image Stitch Plus handles the second case by padding the thinner tensor with ones - the same trick this node performs, exposed as a wire. That's the honest description: the padding step, on its own, with a name.

How it works

The validation pass is identical to its sibling's: [B,H,W,C] batch or single [H,W,C] image (unsqueezed into a batch of one), uint8 divided by 255, other integer dtypes and 2-D/5-D tensors refused, channels must be 1, 3 or 4. Then three branches:

  • four channels - returned unchanged. It's a no-op, which makes it safe to drop into a graph defensively.
  • three channels - torch.ones_like is built from the first channel and concatenated on the end, giving alpha = 1.0.
  • one channel (grayscale) - repeated into R=G=B first, then the alpha is appended.

Output is contiguous float in the shape you handed in, batch preserved. No colour conversion, no premultiplication, no resizing - it's a tensor-shape function and nothing more.

The input and the output

One required input, image (IMAGE), one output, rgba_image (IMAGE, now [B,H,W,4]). No alpha widget, no "fill with" option - 1.0 is hard-coded on purpose, because a knob here would be a trap pretending to be a feature.

The rule that matters is on the output side: only wire rgba_image into nodes that actually accept four-channel images. Many core nodes assume exactly three and will either slice the alpha off silently or fall over. The author's own tooltip says so, and it's the likeliest way this node ruins your afternoon.

Install

ComfyUI Manager: search comfyui-AGSoft (publisher id agsoft), install, restart. Or by hand:

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 search "RGBA". The pack is MIT-licensed, version 2.2.0 and big - well over a hundred nodes - with the deeper documentation in the author's Telegram channel rather than the README, so don't expect the README to explain anything.

Declared dependencies are numpy, opencv-python and translators, but the conversion module imports only torch, so it loads even when the heavier modules didn't. The loader imports every file individually and logs failures per module, so a missing opencv is a console line, not a dead pack.

Where people get burned

Expecting transparency. The most common disappointment, and the node can't help. If you have real alpha - Load Image's MASK output, an RMBG-style removal node, a LayerDiffusion or alpha-video pipeline - use core's Join Image with Alpha, which takes an actual mask and means something by it. That's also the answer to "why is my PNG still solid": the alpha is 1.0.

Round-tripping and losing alpha. AGSoft RGBA to RGB strips the fourth channel; this node puts a fake one back. Chaining them normalises channel count and destroys real transparency on the way. Not a conversion pair - two directions of a one-way door.

Feeding it to something that wants three. The error surfaces two hops downstream as a tensor-shape complaint - a confusing place to arrive from. If a workflow breaks right after you added this, pull it out first.

Saving the result. Four channels into Save Image gives you an RGBA PNG with fully opaque alpha - valid, slightly larger, and pointless unless your destination reads that channel. Keep the PNG as your master anyway; it's the only common format that round-trips a workflow inside it.

Should you install the pack for this?

Honestly? For pure alpha bookkeeping, the core compositing nodes plus a mask cover most workflows. This earns its place when one downstream node demands four channels, or when you already run comfyui-AGSoft and a mixed batch is crashing your stitch. Otherwise it's a two-minute fix you use once and forget - which is what a good utility node should be.

CategoryAGSoft/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGEComfyUI IMAGE tensor [B,H,W,C]. A single image [H,W,C] is also accepted. If alpha is missing, an opaque alpha (1.0) is added. --- Тензор ComfyUI IMAGE [B,H,W,C]. Одиночное изображение [H,W,C] также принимается. Если альфа отсутствует, добавляется непрозрачная альфа (1.0).

Outputs (1)

NameTypeDescription
rgba_imageIMAGER