Nodes/Remove Background/Remove Background
ComfyUI Node

Remove Background

One lazy button for cutting people out — but the mask is backwards

By Sean-Bradley·Created 9 months ago·Updated 8 months ago· 1
Remove Background
  • image
  • RGB
  • RGBA
  • Alpha Mask
background_color

This is the node you grab when you have a picture of a person and you just want the person, with zero configuration. Feed it an image, pick a background color, and out come three things: the cutout on a flat background, the cutout with real transparency, and the alpha mask. It's from Sean Bradley's SBCODE line of nodes, it's a thin wrapper around the rembg library, and it costs you almost nothing to run. It is also not the best cutout quality you can get in 2026, so know what you're trading before you reach for it.

How it works

Under the hood it's rembg - danielgatis's MIT library that's been the standard background-removal tool since 2020 - running its default model, u2net. That's the general-purpose salient-object network: fast, tiny, happy on CPU, and "acceptable but not exceptional" on edges. Fine hair, flyaway strands, veils and anything semi-transparent are exactly where it falls apart, and that has been true since the model shipped. The KB calls this tier "solved since 2020" and it means it: for a solid subject on a contrasting background, u2net is genuinely fine and this node needs nothing from you to use it.

The first time you run it, rembg downloads the u2net ONNX model (around 170MB) into ~/.u2net and caches it, so the first frame has a delay and everything after is fast. The only real dependency is onnxruntime, which rembg uses for inference - no extra torch, no VRAM footprint worth mentioning.

Inputs and outputs that matter

The full input list is two fields:

  • image - any IMAGE tensor. Note this node processes only the first frame of a batch; the rest are silently ignored. No batch mode here.
  • background_color - white, grey, or black. This sets what the RGB output composites the subject onto. It does not touch the RGBA output.

Three outputs:

  • RGB - the cutout composited onto your chosen flat color. This is not your original image with a new background; it's the subject on a solid field. Wire it anywhere you'd wire a normal image.
  • RGBA - the subject with the background made transparent. Save this as a PNG to get an actual transparent file.
  • Alpha Mask - and here's the trap: it's inverted. background=1 (white), foreground=0 (black), which is backwards from ComfyUI's usual white-means-subject convention. The code does this deliberately. Feed this mask into an inpainting or compositing node and you'll be operating on the background, not the person. If something looks subtly wrong downstream, flip it with a MaskInvert node and move on.

Install

Easiest way is ComfyUI Manager - search "Remove Background". Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Sean-Bradley/ComfyUI-Remove-Background.git
cd ComfyUI-Remove-Background
pip install -r requirements.txt

Then restart ComfyUI. requirements.txt is just onnxruntime and rembg, so there's nothing heavy to worry about. On the portable Windows build, use python_embeded\python -m pip install -r ComfyUI/custom_nodes/comfyui-remove-background/requirements.txt per the README. First run also pulls the model automatically.

Where people get burned

  • The inverted mask, again - it's the one that costs people an hour. Check it on a mask preview before trusting it.
  • Batch jobs: feed it a stack of frames and it quietly keeps the first one. Loop it per-image instead.
  • The RGB output surprises people who expected the original background back. It's always the flat color you picked.

When to use something else

If your subject has hair worth keeping, stop here and reach for BiRefNet - since May 2026 it ships in ComfyUI core with its own models/background_removal/ folder, and it's a different class of edge quality. This node is the quick, dependency-light, CPU-friendly path for product shots and clean portraits. And one KB warning applies hard here: don't background-remove your LoRA training set with it (or anything). The model learns to draw blank backgrounds, and you'd be training on your subject on a grey field anyway.

CategorySBCODE

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
background_colorCOMBO3 options: white, grey, black

Outputs (3)

NameTypeDescription
RGBIMAGE
RGBAIMAGE
Alpha MaskMASK