Nodes/ComfyUI-UniversalToolkit/Image Remove Alpha (UTK)
ComfyUI Node

Image Remove Alpha (UTK)

Drop the alpha channel cleanly, with an optional background baked in

By whmc76·Created about a year ago·Updated 2 months ago· 72
Image Remove Alpha (UTK)
  • RGBA_image
  • mask
  • RGB_image
fill_backgroundfalse
background_colorblack

Transparency is great until you need to run an image through a node that only eats 3-channel RGB - and that's most of ComfyUI. Naively dropping the alpha channel just flattens your transparency to whatever color was underneath, usually black, which is how you get cutouts with ugly dark halos. Image Remove Alpha (UTK) from ComfyUI-UniversalToolkit drops the alpha and optionally composites your own background color first, so the flattening looks deliberate instead of accidental.

It's the inverse of the pack's ImageCombineAlpha_UTK and they're meant to be used as a pair - one writes a mask into the alpha channel, the other tears it back out. If you're building pipelines that move RGBA images around, both are worth grabbing.

How it works

It takes an RGBA image, and if fill_background is on, it pastes the image over a solid background_color canvas using the alpha channel as the paste mask - so the pixels that were transparent become your chosen color, with any partial transparency blending naturally at the edges. If fill_background is off, it just drops the alpha channel and returns plain RGB.

That choice is the whole UX. Off is the fast path for "I know the background is already correct." On is for "I need a white-background version of this cutout," which is the classic use case for product shots and profile pics. There's also an optional mask input: if you supply one, it's used as the alpha source instead of the image's own channel, which lets you flatten based on a mask you computed elsewhere.

One detail worth respecting: the node checks whether the input actually has an alpha channel. Feed it a plain RGB image with no mask and fill_background on, and it skips the whole thing with a warning rather than crash - the pack is defensive like that.

Inputs and outputs

  • RGBA_image (IMAGE) - the input, ideally with an alpha channel.
  • fill_background (BOOLEAN, default false) - composite a color first.
  • background_color - black/white/gray plus the primaries and transparent.
  • mask (optional) - override the alpha source.

Single output: RGB_image (IMAGE).

Install and gotchas

Install via ComfyUI Manager (search "ComfyUI-UniversalToolkit") or:

cd ComfyUI/custom_nodes
git clone https://github.com/whmc76/ComfyUI-UniversalToolkit
pip install -r requirements.txt

Restart ComfyUI. No models, no keys.

The trap is subtle: if you feed this node an image that was already flattened to RGB upstream (some nodes silently drop alpha), it can't recover the transparency, and fill_background may do nothing visible. Chain this immediately after whatever produced the RGBA. Also, background_color includes transparent as an option, which sounds contradictory - it's there for when you want to keep some alpha, which effectively means "do nothing to the background." Most people want white or black. And remember the standard advice: for a proper white-background composite, prefer compositing over a color rather than relying on whatever the viewer uses to display transparency, because that's not guaranteed to be white.

CategoryUniversalToolkit/Image

Inputs (4)

NameTypeDefaultDescription
RGBA_imageIMAGE
fill_backgroundBOOLEANfalse
background_colorCOMBOblack10 options: black, white, gray, red, green, blue, +4
maskoptMASK

Outputs (1)

NameTypeDescription
RGB_imageIMAGE