Image Remove Background
One-node background removal with u2net
- images
- rembg_model
- images
This is the one-node "cut out the subject" button. Image Rembg wraps the well-known rembg library - the same MIT-licensed tool that's been the community's default background remover since 2020 - and hands you back the image with the background gone. No mask painting, no threshold fiddling: feed it an image, get a subject on transparency.
Worth separating this from WAS's other background node. "Image Remove Background (Alpha)" works by color threshold and tolerance, which only helps on flat, contrasting backgrounds. Image Rembg uses an actual segmentation model, so it works on real photos with busy backgrounds. If you only try one, try this one.
How it works
rembg runs a salient-object segmentation network - historically u2net - that predicts which pixels are foreground and knocks out the rest. The background-removal KB is clear on where this sits: u2net is "fast, reliable, tiny, no meaningful VRAM overhead, and it runs on CPU," which is exactly why rembg stayed the default for years. The catch is edge quality: "fine hair, transparent materials (veils, glass), and complex edges all suffer, and that has been true and unfixed since 2020."
So this node is the right tool for a solid subject against a distinguishable background - product shots, a person in a clear scene. It's the wrong tool for flyaway hair or a wine glass. For those the KB points to BiRefNet (now in ComfyUI core) or a matting model, which represent partial transparency that u2net's hard fore/background split simply can't.
Inputs and outputs that matter
The input that matters is the image to process. The output is the image with its background removed - a subject on transparency (RGBA), ready to composite over a new background with Image Blend by Mask or paste elsewhere.
The thing to internalize from the KB: choosing rembg is choosing an interface, and if you're on u2net it's the quality that costs you. The library itself now bundles better weights (isnet, BiRefNet variants), but this WAS node predates that shift and leans on the classic u2net path - good enough for easy subjects, not a hair-and-glass solution.
How to install it
ComfyUI Manager: search was-node-suite-comfyui, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui
then install the pack's requirements.txt in your ComfyUI venv and restart. This node needs the rembg package, which pulls in onnxruntime, and on first use rembg downloads its model weights (the u2net file, ~170MB) automatically. That first run will pause while it fetches the model - normal, not a hang.
Common issues & troubleshooting
The node errors that rembg isn't installed. rembg is a real dependency and doesn't always come through cleanly with the pack's bulk requirements. Install it into your ComfyUI venv explicitly (pip install rembg, activating the venv first, or the python_embeded route on portable), then restart.
First run stalls, then works. rembg downloads its model on first use. Give it a minute on the first image; subsequent runs are fast.
Edges are chewed up around hair. Expected - this is u2net's known weakness, per the KB, unchanged since 2020. For difficult edges use BiRefNet (native in current ComfyUI) or a matting model instead; no setting on this node fixes a hair fringe a hard mask can't represent.
Don't background-remove your LoRA training set with this. A recurring KB warning worth repeating: stripping backgrounds from training images teaches the LoRA to generate blank backgrounds. This node is for compositing finished images, not for cleaning a dataset.
Whole pack won't import after a ComfyUI update. The standard WAS Node Suite issue - package downgrades vs a ComfyUI bump. Re-run the pack's requirements against the activated venv, or install.bat. Maintenance-only since late 2023.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | The images to cut out. Every image in the batch is processed. | |
| rembg_model | REMBG_MODEL | The cutout network, from Image Remove Background Model Loader, which is where the choice of model is made. One loader can feed several nodes so the network is built once. | |
| transparency | BOOLEAN | true | On, the background becomes transparent and the result carries an alpha channel. Off, the result is a plain colour image and the background is whatever background_color says, or black when that is `none`. |
| post_processing | BOOLEAN | false | Tidy the cutout by removing stray specks and filling pinholes. Helps on a busy background and can nibble at thin details such as stray hairs. |
| only_mask | BOOLEAN | false | Return the cutout shape itself as a greyscale image, white where the subject is, instead of the subject's pixels. Useful as a mask for another node. The result is always three channels, so transparency and background_color do nothing while this is on. |
| alpha_matting | BOOLEAN | false | Refine the edge with alpha matting, which recovers soft detail such as hair and fur. Noticeably slower, and it is what the three alpha_matting values below control. |
| alpha_matting_foreground_threshold | INT | 2400–255 | How certain a pixel has to be to count as definitely the subject, from 0 to 255. Lower takes in more of the edge as subject; the default 240 keeps only the most confident core. |
| alpha_matting_background_threshold | INT | 100–255 | How certain a pixel has to be to count as definitely background, from 0 to 255. Higher discards more of the edge; the default 10 leaves everything between the two thresholds for the matting to decide. |
| alpha_matting_erode_size | INT | 100–255 | How far in from the edge, in pixels, the uncertain band is grown before matting. Larger values give the matting more room to work and soften the edge; 0 leaves the band as the thresholds drew it. |
| background_color | COMBO | none | What to put behind the subject. `none` leaves it empty. The rest fill it: `chroma green` and `chroma blue` are the two standard keying colours, and `magenta` is an easy colour to spot leftovers against. With transparency on, the fill is written fully transparent, so it only shows once the alpha channel is discarded. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | The cut-out images, as a batch the same length as the input. Four channels when transparency is on, three when it is off or when only_mask is on. |