LC Remove Background ✂️
BiRefNet in one node, with the license printed on the dropdown
- image
- cutout
- mask
- on_background
Background removal is the most commoditized operation in this ecosystem. The models are free, they're fast, and the frontier stopped moving a while ago - since BiRefNet HR landed in early 2025, every "new SOTA remover" has either gone nowhere (BEN2, twenty-odd mentions and silence) or turned out to be a repackaging. What changed since then isn't quality, it's placement: ComfyUI shipped BiRefNet in core in May 2026, and this node reaches straight into that loader.
So the question isn't whether BiRefNet is good. It is - it's the default recommendation for anything with a difficult edge. The question is what this particular node gives you on top.
What it is
A BiRefNet cutout with an optional trimap-based refine pass bolted on. Three outputs:
- cutout - the subject as an RGBA image, mask as alpha.
- mask - the mask itself, for inpaints, blends, or grading.
- on_background - the subject composited onto a solid color you choose (black, white, gray, green, blue, magenta). The green-screen output is the one people miss; it's a two-second way to eyeball whether your edge is actually clean, and a clean cutout against saturated green is a much harsher test than against grey.
Choosing the model is the real decision
The model dropdown lists four BiRefNet variants, all MIT, all downloaded on first use into models/background_removal - the same folder ComfyUI's own loader reads, so nothing duplicates if you've used the built-in node:
- general - the default. 1024 native. Pick this unless you have a specific reason not to.
- matting - predicts fractional alpha instead of a hard mask. This is a different output type, not a better version of general. If your subject is a veil, glass, smoke, or anything with genuine partial transparency, segmentation weights are structurally incapable of representing a half-transparent pixel and no amount of tweaking fixes that. Use matting.
- portrait - people, trained on portrait data.
- HR 2048 - for inputs above roughly 1500px. Feeding a 4K image to the 1024 model means it downscales internally and throws away exactly the edge detail you were trying to keep, which is the single most common reason people report worse results than they should be getting.
Then there's refine, and here the node is doing something the stock loader doesn't. none uses the model's mask as-is. guided_filter is fast, no model, and snaps the uncertain edge band to actual image edges. vitmatte runs a real matting model - the same VITMatte weights LC Mask Refine uses (Apache-2.0, models/vitmatte) - over a band defined by edge_erode and edge_dilate (10/10 by default; shrink both toward 3 for a tighter edge). If you're cutting out hair, this is the setting that matters most, and it's worth the extra download.
The rest of the controls are the standard matting knobs: grow shifts the mask before refining, black_point / white_point crush the extremes, feather softens the final edge, and max_megapixels (2 by default) caps how big an image vitmatte actually runs on.
My honest read on the refine options: run general + guided_filter first. If hair survives, stop. Only go to vitmatte when it doesn't, because it's a second model download and real time on every image.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC_MaskMaker_nodes
# restart ComfyUI
Manager → search LC MaskMaker. No extra pip dependency - the node calls comfy.bg_removal_model, so you need a ComfyUI new enough to have the built-in background-removal loader (the May 2026 core addition). On anything older, this node won't load; the pack logs a failure for that one module and the others keep working, which is at least a graceful way to find out.
RMBG-2.0: if you already have it in models/RMBG/RMBG-2.0 the node will use it, and it will not be downloaded for you. Its license is non-commercial - worth knowing before it ends up in something you're selling.
Gotchas
- The subject has a faint halo against colored backgrounds. Raise black_point. You're looking at mask values the model wasn't confident about, and the halo is visible the moment the background isn't neutral.
- Hair is a fringe of noise. That's a segmentation model doing a matting job. Switch refine to vitmatte, or switch the model to matting weights.
- Your old
BiRefNet-ep480.pthisn't in the list. Correct - that file layout predates what ComfyUI can load. Older.pthfiles are deliberately excluded rather than half-working. - The cutout looks right, the composite looks wrong. Not an edge problem. Compositing a subject onto a new background without matching the light direction reads as pasted no matter how clean the mask is - that's a relighting step, not a mask step.
- Do not background-remove your LoRA training set. This is the most repeated non-obvious finding about this tool class, and it's true: stripping backgrounds teaches the LoRA to generate blank backgrounds. Use the alpha as a loss mask instead, or just caption honestly.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image to cut the subject out of. | |
| model | COMBO | Background removal model. The license is in the label. Entries marked 'Download' are fetched the first time you run. | |
| refine | COMBO | none | none: use the model's mask as is. guided_filter: fast, snaps the edge to the image. vitmatte: matting model for hair and fine detail. |
| vitmatte_model | COMBO | Only used when refine is vitmatte. | |
| grow | FLOAT | 0.0-512–512 | Pixels to grow (positive) or shrink (negative) the mask before refining. |
| edge_erode | FLOAT | 10.00–1024 | Refine trimap: how far the sure-foreground area is pulled in from the mask edge. Smaller = tighter. |
| edge_dilate | FLOAT | 10.00–1024 | Refine trimap: how far the unknown band reaches past the mask edge. Smaller = tighter. |
| black_point | FLOAT | 0.0000–0.999 | Mask values at or below this become 0. Raise it to clear faint background haze. |
| white_point | FLOAT | 1.0000.001–1 | Mask values at or above this become 1. Lower it to solidify the subject. |
| feather | FLOAT | 0.00–100 | Final edge softness in pixels. |
| max_megapixels | FLOAT | 2.000.25–16 | vitmatte only. Larger images are matted at this size, then scaled back. |
| background | COMBO | black | Color behind the subject in the on_background output. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| cutout | IMAGE | — |
| mask | MASK | — |
| on_background | IMAGE | — |