πΎ Remove Background Pro
Eight rembg models, mask cleanup, and a preview β background removal without leaving the graph
- image
- image_passthrough
- masked_image
- mask
- mask_bw
Background removal is the most commoditized operation in this whole ecosystem, and it's a race with a moving target: the models are free, and the real difference between them is how they handle hair, fur, and semi-transparency. πΎ Remove Background Pro is a rembg wrapper that bundles eight segmentation models behind one node, then adds the part most single-model nodes forget - mask cleanup (grow/shrink, blur, fill holes) and an in-node preview. It's not the fanciest remover, but it's a complete one.
The model picker is the whole decision
The model dropdown is where the results come from. The defaults the KB's background-removal essay maps out: u2net (general-purpose, the historical default - fast, runs on CPU, but edge quality is merely acceptable and has been since 2020), u2netp (lightweight u2net), u2net_human_seg (people), u2net_cloth_seg (garment parsing), silueta (u2net's network at 43MB), isnet-general-use and isnet-anime (better edges; the anime variant is the one to reach for on illustration), and sam (a quantized Segment Anything pair, useful when you want the model that "gets" the specific object).
The honest take, and it's straight from the KB: choosing rembg is choosing an interface, not a quality ceiling. u2net is your fast-and-cheap option, not your hair-and-fur option. For fine boundaries you're usually better off with BiRefNet - which has shipped in ComfyUI core since May 2026, no custom node needed. What this node gives you over core is the convenience of all eight models in one dropdown plus built-in refinement.
Inputs that matter
Required: image and model. The optional stack splits into three groups:
- Mask refinement -
grow_shrink(Β±100),blur_radius(0β50),fill_holeswithhole_size_threshold, andinvert_mask. Same controls as the pack's Mask Editor, applied to the cutout automatically. - Preview -
preview_mode:transparency_grid,black_bg,white_bg,no_bg,mask_bw, ororiginal. This is how you judge a cutout honestly - a hair edge that looks clean on black may fall apart on white. - Alpha matting -
alpha_mattingplusforeground_threshold,background_threshold, anderode_size. Only flip this on when you have genuinely semi-transparent material (veils, glass, smoke); it's slower and can degrade clean edges.
Outputs are unusually generous: image_passthrough (original, for chaining), masked_image (the cutout on your chosen preview background), mask (the MASK itself - feed this into compositing or inpainting), and mask_bw (a black-and-white IMAGE view of the mask). The mask output is the one that makes this a building block rather than a dead end.
Installing it - the one with real dependencies
This node is where the pack's dependency story actually bites. The pack requires rembg>=2.0, and on first use rembg downloads the chosen model into ~/.u2net (u2net is roughly 170MB; each model you switch to downloads separately). Expect the first run to hang while it fetches. Install:
cd ComfyUI/custom_nodes
git clone https://github.com/machinepainting/ComfyUI-MachinePaintingNodes.git
cd ComfyUI-MachinePaintingNodes
pip install -r requirements.txt # opencv-python-headless, numpy<3, rembg
or just ComfyUI Manager β search "MachinePaintingNodes". One useful detail from the changelog: the pack pins opencv-python-headless and numpy<3 specifically because those two have caused install conflicts on headless servers and with NumPy 3 - if you hit an install error here, that pinning is why they fixed it.
Troubleshooting
- First run is slow - that's the model download, not a bug. Let it finish once; later runs use the cache.
- u2net leaving fuzzy hair edges? That's the model, not the node. Try
isnet-general-use, or step up to core BiRefNet. The mask cleanup can only trim a bad mask, not resurrect fine detail. - rembg import errors mean the pip install didn't take - your ComfyUI python env and your shell python aren't the same thing. Install into the same environment ComfyUI runs (
python_embededon Windows). - Transparent "no_bg" preview looks right but the output is still checkerboarded - you're looking at
masked_imagewith the grid; grabmask+image_passthroughand composite yourself if you need true alpha downstream.
For quick extraction and batch throughput on CPU, u2net is solved since 2020 and costs nothing. For anything with hard edges, know when to reach past it. This node makes the first half of that sentence pleasant.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| model | COMBO | u2net | 8 options: u2net, u2netp, u2net_human_seg, u2net_cloth_seg, silueta, isnet-general-use, +2 |
| grow_shrinkopt | INT | 0-100β100 | β |
| blur_radiusopt | FLOAT | 0.00β50 | β |
| fill_holesopt | BOOLEAN | false | β |
| hole_size_thresholdopt | INT | 500100β10000 | β |
| invert_maskopt | BOOLEAN | false | β |
| preview_modeopt | COMBO | transparency_grid | 6 options: transparency_grid, black_bg, white_bg, no_bg, mask_bw, original |
| alpha_mattingopt | BOOLEAN | false | β |
| alpha_matting_foreground_thresholdopt | INT | 2400β255 | β |
| alpha_matting_background_thresholdopt | INT | 100β255 | β |
| alpha_matting_erode_sizeopt | INT | 100β40 | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image_passthrough | IMAGE | β |
| masked_image | IMAGE | β |
| mask | MASK | β |
| mask_bw | IMAGE | β |