Nodes/ComfyUI-Apt_Preset/Mask_Remove_bg2
ComfyUI Node

Mask_Remove_bg2

Background removal with RMBG-2.0, InSPyReNet or BEN2

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
Mask_Remove_bg2
  • image
  • Remove_img
  • mask
model
sensitivity1.00
process_res1024
mask_blur0
mask_offset0
invert_outputfalse
refine_foregroundfalse
backgroundAlpha

Background removal is the most commoditized operation in this whole ecosystem - the models are free, fast, and there are a lot of them - and still nobody agrees on a single best one. Mask_Remove_bg2 doesn't try to pick a winner for you; it gives you a choice of three well-regarded models in one node and lets you switch between them.

What it does

The model dropdown offers RMBG-2.0, INSPYRENET, and BEN2 - not a random assortment. These are the same three background-removal backends that show up bundled together in 1038lab's well-known ComfyUI-RMBG pack, so it's a reasonable bet this node is built on the same underlying models rather than something bespoke. Each has its own reputation: InSPyReNet is the perennial dark horse that keeps beating "newer, better" models on hair and fur in community head-to-heads despite predating most of them; RMBG-2.0 is a solid general-purpose default; BEN2 launched in 2025 with vendor benchmarks claiming a speed edge over RMBG-2.0/BiRefNet, but never really caught on afterward - worth trying, not worth assuming is automatically the fastest or best in your case.

One thing worth noting as a limitation: BiRefNet, which the wider community now treats as the default recommendation for hard edges (hair, fur, semi-transparent material) and which ComfyUI shipped natively in May 2026, isn't one of the three options here. If BiRefNet is specifically what you're after, you'll need a different node - this one's strength is the InSPyReNet/RMBG-2.0/BEN2 trio, not full coverage of the field.

Past the model choice, the controls are standard for this class of node: sensitivity tunes how aggressively pixels get classified as foreground, process_res sets the internal working resolution (bump this up if your input is high-resolution - feeding a 4K image to a model that internally downscales to a lower resolution throws away exactly the edge detail you're trying to keep), mask_blur and mask_offset feather or grow/shrink the resulting mask edge, invert_output flips foreground and background, and refine_foreground runs an extra edge-cleanup pass.

Inputs and outputs

Required: image, model (RMBG-2.0 / INSPYRENET / BEN2). Optional: sensitivity (0–1, default 1), process_res (256–2048, default 1024), mask_blur (0–64), mask_offset (-64 to 64), invert_output, refine_foreground, background (Alpha/white/black/green/red/blue/gray fill for the removed area).

Outputs: Remove_img (the cutout, IMAGE) and mask (MASK) - wire the mask into inpainting or compositing, the image straight to Preview/Save if the cutout itself is the deliverable.

Where this fits

Product photography extraction, compositing a generated subject into a new scene, or feeding a clean mask into a downstream inpaint - the standard background-removal use cases. If you're specifically fighting flyaway hair or a semi-transparent subject, try INSPYRENET first - community testing repeatedly finds it competitive with or ahead of newer models on exactly that failure case.

Installing it

ComfyUI Manager: search ComfyUI-Apt_Preset. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git

Run install.bat (Windows) or install requirements.txt yourself, restart ComfyUI. The README doesn't call out a separate manual download step for this node's models the way it does for the face/clothes/body segmentation nodes - expect the model weights to download automatically on first use, and give it time and a stable connection the first time you switch to a model you haven't run yet.

Troubleshooting

Check for a pack-wide import failure first if the node's missing - ComfyUI-Apt_Preset is large and there's a documented IMPORT FAILED case for it; check your ComfyUI console at startup.

Beyond that, the most common self-inflicted issue with any model in this trio is process_res mismatched to your input: a low process_res on a high-resolution image loses fine edge detail before the model even gets a chance at it, so raise it if hair or fine detail is coming out mushy. If two models disagree sharply on the same image, that's expected and not a bug - there is no settled winner between RMBG-2.0-class models and InSPyReNet, and the honest move is to just run both on your hardest image and keep whichever one actually looks right, rather than trusting either one's reputation blindly.

CategoryApt_Preset/mask

Inputs (9)

NameTypeDefaultDescription
imageIMAGE
modelCOMBO3 options: RMBG-2.0, INSPYRENET, BEN2
sensitivityoptFLOAT1.000–1
process_resoptINT1024256–2048
mask_bluroptINT00–64
mask_offsetoptINT0-64–64
invert_outputoptBOOLEANfalse
refine_foregroundoptBOOLEANfalse
backgroundoptCOMBOAlpha7 options: Alpha, white, black, green, red, blue, +1

Outputs (2)

NameTypeDescription
Remove_imgIMAGE
maskMASK