Nodes/Comfyui HiFORCE Plugin/Convert Image to RGBA
ComfyUI Node

Convert Image to RGBA

Give Any Image a Fourth Channel (It's Opaque, But the Node Can't Tell)

By hiforce·Created 3 years ago·Updated 2 years ago· 12
Convert Image to RGBA
  • images
  • IMAGE

HfImageToRGBA is the mirror image of its sibling HfImageToRGB: it takes any image tensor and converts it to four-channel RGBA. That's the whole job. One input, one output, nothing to configure, no model to download. If you've ever stared at a shape mismatch error and wished you could just make the channel count whatever the next node wanted, this is that wish, mechanized.

The trigger for using it is narrower than the RGB version, but real. Most of ComfyUI works in 3-channel RGB, but a few pipelines expect a 4-channel input - usually ones that deal with transparency as a first-class thing. LayerDiffusion-style workflows that generate alpha, certain compositing or image-to-image chains, and some save paths. When a node's input socket expects RGBA and you're feeding it an ordinary RGB image, the connection simply won't accept the wire, and this converter is the handshake that fixes it.

How it works. The logic in the HiFORCE image library is a channel-count ladder:

  • already 4 channels → passes straight through untouched
  • 3 channels → appends a fourth channel filled with 1.0 (fully opaque)
  • 1 channel → repeats it four times
  • no channel dimension → pads up to 4

Here's the thing worth understanding before you expect magic: the alpha it adds is all ones. Fully opaque. So this node doesn't create transparency, and it won't turn a subject cutout into a floating PNG. It produces a valid RGBA image where every pixel is 100% solid - which is exactly what a picky node needs, and not what a background-removal tool would give you. If the input already has real alpha (a transparent PNG, say), that alpha survives untouched; the node only fills in the channel when it's missing.

The input is a plain images IMAGE tensor and the output is IMAGE. The HfImageToRGB sibling in the same pack is the exact inverse, so if you ever need to flip-flop between 3- and 4-channel modes in one workflow - say, transparent in, opaque RGB for the sampler, back to RGBA for the save - the two nodes cover the whole loop and you never hand-assemble a channel.

Honest framing: this is a utility you reach for maybe once per workflow, not a star of the show. And its usefulness depends on your pipeline - if you never touch alpha-bearing images, you may never need it. But when a downstream node rejects your RGB tensor and you're Googling "comfyui convert to rgba," this is the direct answer.

It ships in Comfyui HiFORCE Plugin, from HiFORCE (hiforce.net). The pack's real reputation is built on its sampler nodes - Basic Sampler, Loopback Sampler, the mask-aware two-step samplers - and the image converters here are supporting cast. Install via ComfyUI Manager (search "Comfyui HiFORCE Plugin") or:

cd ComfyUI/custom_nodes
git clone https://github.com/hiforce/comfyui-hiforce-plugin.git
cd comfyui-hiforce-plugin
pip install -r requirements.txt

Restart ComfyUI and you'll find the converters under HiFORCE → Image → Convert. The README asks you to install ComfyUI-Impact-Pack first, since a lot of the pack is built on its foundation - worth doing even if these particular nodes are light. Dependencies are just torch, numpy, Pillow, and requests, all already present in a standard ComfyUI environment, and there are no model downloads.

One caveat from the pack's actual usage: it gets almost zero community discussion (we checked - basically nothing on Reddit). It's a niche pack you find through Manager, so when something behaves unexpectedly, read the source or the GitHub wiki rather than hunting for forum posts.

CategoryHiFORCE/Image/Convert

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE