Image Remove Alpha
Flatten a transparent PNG onto a color before the alpha eats your edges
- image
- fill_color
- IMAGE
"Image Remove Alpha" composites a transparent image onto a solid fill color, outputting a flat RGB image with no alpha channel at all. That sounds like the boring thing - "just delete the alpha" - but it's actually the useful thing, because "just delete" leaves you with black garbage where the transparency was. This node does it properly: transparent pixels become your chosen color through real alpha blending.
Why you'll actually need this: a ton of downstream nodes want plain RGB. Save nodes that write JPEG, compositors, anything that treats input as "no alpha," and especially nodes that don't expect 4 channels at all - feeding RGBA into something built for RGB is how you get weird channel-count errors or images that render with their transparent pixels as black blobs. If you've got a cutout that came out of background removal, this is the polite way to put it back on a background.
How it works
For each pixel it computes result = rgb × alpha + fill_color × (1 − alpha). Fully opaque pixels keep their color; fully transparent pixels become the fill; the edges in between blend smoothly. That smooth blend is the whole advantage over dropping the channel - hair and soft edges pick up a gradient into the fill color instead of a hard, jagged outline. If the input has no alpha (it's already 3-channel), the node just hands it back unchanged, so it's safe to drop into a chain without checking first.
Inputs and output
- image (IMAGE) - ideally RGBA.
- fill_color (COLOR, default
#000000) - the background color transparent areas melt into.
Output is a single IMAGE, RGB, no alpha.
Where people get burned
The default fill is black, and black is a hostile background for a subject with a light rim or bright hair - you'll get a dark halo. If your cutout has light edges, set fill_color to something close to where it'll live (white is a common choice) or you'll be fighting edge artifacts later. There's no mode switch beyond the color - no checkerboard, no outside-only fill - so if you want anything fancier, composite the cutout onto a real background image instead of using this.
One genuinely nice property: fill_color is a COLOR input, and this pack ships "Hex to Color" specifically so you can drive it from a hex string. So you can feed the fill from a prompt, an API call, or a list of colors for batch runs instead of clicking a color wheel per image.
Installing it
It's part of comfyui-common-util:
cd ComfyUI/custom_nodes
git clone https://github.com/longgui0318/comfyui-common-util
cd comfyui-common-util && pip install -r requirements.txt
Restart, or install via ComfyUI Manager by searching "comfyui-common-util". requirements.txt lists only opencv-python, but the pack also imports scipy, scikit-image, and PyWavelets at load - if it won't load, pip install scipy scikit-image PyWavelets and restart.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| fill_color | COLOR | #000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |