Nodes/SDVN_Comfy_node/🎨 Fill Background
ComfyUI Node

🎨 Fill Background

Flatten a transparent image onto a solid color

By StableDiffusionVNΒ·Created 2 years agoΒ·Updated 29 days agoΒ· 118
🎨 Fill Background
  • image
  • filled_image
β—„background_color#FFFFFFβ–Ί

Dead-simple utility: take an image with a transparent background and paint the see-through areas a solid color. That's it. It's the node you reach for right after a background remover, when you've got a cut-out subject on transparency and you need it on a clean white (or any color) backdrop instead of an alpha channel.

Why you'd want it

Transparency is great for compositing and useless for a lot of the things you actually do next. Plenty of models and nodes don't understand an alpha channel - they'll either ignore it, fill it with black, or choke. If you've run a subject through BiRefNet or any background-removal node and now want to feed that cut-out into an upscaler, a style pass, or just save a JPEG (which has no transparency at all), you need to flatten it first: replace the transparent pixels with real ones. Fill Background does exactly that, one color, no fuss. Product shots on white, stickers on a flat backdrop, prepping a subject for a model that wants RGB - all the same move.

The inputs and outputs that matter

  • image - the image to flatten. It needs an actual alpha channel for there to be anything to fill; a fully opaque image comes out unchanged.
  • background_color (default #FFFFFF) - the fill color as a hex code. White by default; set it to #000000 for black, or any hex you like for a custom backdrop.

The single output is filled_image - your image with the transparent areas replaced by the solid color, now a normal opaque RGB image ready for anything downstream.

Installing it

ComfyUI Manager: search SDVN_Comfy_node, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node

Then pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt from your ComfyUI root, and restart. Pure image utility - no models, nothing to download.

Where people get burned

No alpha, no effect. The node fills transparent pixels. If your image doesn't carry an alpha channel - say it came out of a model that already put it on a black background - there's nothing transparent to replace, and you'll get the same image back. The fix is upstream: make sure your background remover is actually outputting transparency (an RGBA image), not a subject baked onto a color. Some removers output a separate mask instead of true alpha; you may need to apply that mask first.

Hard edges. This is a straight fill, not a matte-aware composite. If the background removal left a rough or fringed edge, filling behind it won't soften anything - you'll see the jagged cut against the new color. Clean the mask upstream if edges matter.

It's for flattening, not masking. If what you actually want is to replace the background with a new scene (not a flat color), that's a compositing or inpaint job, not this node. Fill Background only does solid colors.

CategoryπŸ“‚ SDVN/🏞️ Image

Inputs (2)

NameTypeDefaultDescription
imageIMAGEβ€”
background_colorSTRING#FFFFFFβ€”

Outputs (1)

NameTypeDescription
filled_imageIMAGEβ€”