ComfyUI Node for Background Removal
ComfyUI · Open weights in-process · RGBA + mask · Optional Pro engine

Requirements#
| Dependency | Notes |
|---|---|
| ComfyUI | Any recent version; install into its custom_nodes folder |
| Python 3.10+ | ComfyUI's own Python environment |
withoutbg>=1.5.0 | Installed by requirements.txt; brings ONNX Runtime and OpenCV (headless) |
Install#
Clone into ComfyUI's custom_nodes folder and install the requirements into ComfyUI's Python environment with uv:
Manual install
cd ComfyUI/custom_nodes
git clone https://github.com/withoutbg/withoutbg-comfyui
# activate ComfyUI's venv first, or add --python path/to/venv/bin/python
uv pip install -r withoutbg-comfyui/requirements.txtNo uv? pip install -r withoutbg-comfyui/requirements.txt with ComfyUI's Python works too. Once the first registry release is out, comfy node install withoutbg-comfyui (comfy-cli) does both steps.
Restart ComfyUI. The node is under image / withoutBG. The node is also published to the Comfy Registry (publisher withoutbg); once the first registry release is out, you can find it in ComfyUI-Manager by searching withoutBG.
An example workflow is in example_workflows/remove_background.json: Load Image, withoutBG Remove Background, Save Image.
The node: withoutBG Remove Background#
Inputs#
| Input | Type | Notes |
|---|---|---|
image | IMAGE input | Any batch size |
engine | Choice | open_weights (default, local, free) or pro (Cloud API) |
Outputs#
| Output | Type | Notes |
|---|---|---|
image | IMAGE | RGBA: original colours plus the matte as alpha. Save with Save Image for a transparent PNG. |
mask | MASK | The alpha matte, foreground = 1 |
Batches are processed frame by frame with a progress bar, and you can interrupt the queue between frames.
Engines#
| Engine | Runs | Cost | Privacy |
|---|---|---|---|
| open_weights | In-process ONNX on CPU | Free | Never leaves your machine |
| pro | withoutBG Cloud API | 1 credit per image | Image is sent to api.withoutbg.com |
Open weights (default)#
The first run downloads the model from Hugging Face (withoutbg/withoutbg-openweights-onnx) into the Hugging Face cache. Set WITHOUTBG_MODEL_PATH to use a local model file. Runs on CPU. Same weights as the Python package, the Mac app and Docker.
Pro (optional)#
Pro is opt-in and needs an API key from your account. Each image costs 1 credit and is sent to the withoutBG API; open weights never leave your machine. Set the key in the environment before starting ComfyUI:
API key
export WITHOUTBG_API_KEY=... # then start ComfyUI from this shellThe node has no key field on purpose. ComfyUI saves widget values in workflow files and embeds the workflow in every PNG it saves, so a pasted key would travel with anything you share.
Make a transparent PNG#
- Add a Load Image node and pick a photo.
- Add withoutBG Remove Background (image / withoutBG) and connect
IMAGEtoimage. - Connect the node's
imageoutput to Save Image. Queue the prompt. - Use the
maskoutput anywhere ComfyUI takes a MASK (inpainting, compositing, ControlNet preprocessing).
Troubleshooting#
| Symptom | Fix |
|---|---|
| Node not found after install | Restart ComfyUI. The node is under image / withoutBG; you can also double-click the canvas and search "withoutBG". |
| import cv2 fails (OpenCV conflict) | withoutbg depends on opencv-python-headless. If ComfyUI already has opencv-python, the installer may add both. Reinstall one: uv pip uninstall opencv-python opencv-python-headless && uv pip install opencv-python-headless (or the same with pip, adding -y to uninstall) |
| onnxruntime missing | The package needs onnxruntime. Environments with onnxruntime-gpu keep working; the model still runs on CPU. |
| First run is slow | The model downloads from Hugging Face on first use. Later runs load it from the cache. |
| Pro engine fails | Check that WITHOUTBG_API_KEY is set in the shell ComfyUI was started from, and that the account has credits. |
Model and license#
Node code: Apache 2.0. Model: the withoutBG Open Model License (Apache 2.0 for withoutBG portions; Meta DINOv3 License for the DINOv3 backbone weights). Built with DINOv3.
Common questions#
- Does the ComfyUI node upload my images to the cloud?
- Not with the default open_weights engine. The model runs in-process inside ComfyUI and images never leave your machine. Only if you switch the engine to pro (and set an API key) are images sent to api.withoutbg.com, at 1 credit per image.
- Do I need a separate server or Docker?
- No. Unlike the GIMP and Krita plugins, the ComfyUI node runs the model itself through the withoutbg Python package. There is no local server to start.
- What does the node output?
- Two outputs: image, an RGBA image with the original colours and the matte as alpha (save it with Save Image for a transparent PNG), and mask, the alpha matte with foreground = 1.
- Does it process batches and video frames?
- Yes. The image input accepts any batch size and each frame is processed in turn, with a progress bar and support for interrupting the queue.
- Where does the model download to, and can I use a local file?
- The first run downloads withoutbg/withoutbg-openweights-onnx from Hugging Face into the Hugging Face cache. Set WITHOUTBG_MODEL_PATH to use a local model file instead.
- Does it need a GPU?
- No. The open weights engine runs on CPU through ONNX Runtime. Environments that have onnxruntime-gpu installed keep working; the model still runs on CPU.
- Why is there no API key field on the node?
- ComfyUI saves widget values in workflow files and embeds the workflow in every PNG it saves, so a pasted key would travel with anything you share. Set WITHOUTBG_API_KEY in the environment before starting ComfyUI instead.
Related#
| Resource | Link |
|---|---|
| Python package | /docs/open-model/python |
| GIMP plugin | /open-model/plugins/gimp |
| Krita plugin | /open-model/plugins/krita |
| Pro Model API | /pro-model-api |
| Open Model | /open-model |
| Model weights (Hugging Face) | withoutbg/withoutbg-openweights-onnx |
| Node source | github.com/withoutbg/withoutbg-comfyui |