ComfyUI-RMBG: background removal and segmentation nodes for ComfyUI
A ComfyUI custom node designed for advanced image background removal and object, face, clothes, and fashion segmentation, utilizing multiple models including RMBG-2.0, INSPYRENET, BEN, BEN2, BiRefNet, SDMatte, SAM, SAM2, SAM3 and GroundingDINO.
At a glance
- What is it?
- ComfyUI-RMBG is a GPL-3.0 custom node pack that wraps RMBG-2.0, BEN, BEN2, BiRefNet, SDMatte, SAM, SAM2, SAM3 and GroundingDINO behind ComfyUI nodes. It is for people who already run ComfyUI and want masking inside the graph, not in a separate app.
- Who is it for?
- Adopt ComfyUI-RMBG if you already run ComfyUI and want segmentation as a node instead of a separate tool, and you accept a GPL-3.0 licence plus a heavy dependency set (onnxruntime and onnxruntime-gpu, groundingdino-py, segment-anything, hydra-core). Skip it if you only need one clean cutout per image, since a single-purpose background removal service or library will be lighter.
- Can I use it commercially?
- Yes, with conditions. GPL-3.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
- Is it still maintained?
- Yes. The repository last received commits 28 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What ComfyUI-RMBG actually does
ComfyUI-RMBG is a custom node pack for ComfyUI, the node-based Stable Diffusion front end. Instead of running background removal as a separate step, it puts masking and segmentation inside the graph, so a mask can feed a sampler, an inpainting node or a compositing node without leaving the workflow.
The README describes the scope as background removal plus segmentation of objects, faces, clothing and fashion elements, with real-time background replacement and edge detection as supporting features. The model list is the real selling point: RMBG-2.0, INSPYRENET, BEN, BEN2, BiRefNet, Lucida, SDMatte, SAM, SAM2, SAM3 and GroundingDINO. Those are different tools for different jobs. BiRefNet is a matting model family, SAM and SAM2 are promptable segmenters, GroundingDINO turns text into boxes, and RMBG-2.0 is the general cutout model.
The target user is a ComfyUI user who iterates on images and needs masks repeatedly. If your masking happens once per asset in Photoshop or a web service, the node pack is more machinery than the task needs.
How the nodes and models fit together
The repository layout shows the split: py/ holds the Python node implementations, models/ holds model definitions, web/ holds the front-end widget code, locales/ holds translations, and example_workflows/ holds graphs you can load. The custom node entry point is the top-level __init__.py, which is how ComfyUI discovers the pack.
Functionally, the nodes fall into three groups. Loader and input nodes (the README mentions LoadImage being split into three distinct nodes, all supporting direct loading from local paths or URLs) bring images in. Segmentation and matting nodes run a chosen model and emit a mask. Utility nodes such as Mask Enhancer, Mask Combiner, Mask Extractor, ImageMaskResize, MaskOverlay, CropObject, ImageCompare and ImageStitch clean up and combine the results.
The model choice is the main design decision. A text-prompted node such as SAM2Segment, described in the v2.8.0 notes as text-prompted segmentation with Facebook Research SAM2, needs a prompt and a model download. A BiRefNet node runs a matting model and exposes parameters like sensitivity, added in v3.1.0. GroundingDINO sits behind the object detection path. Each model has its own download and its own memory footprint, which is the cost of having them all in one pack.
Installing ComfyUI-RMBG and running a first segmentation
The repository does not ship an install script in the files available, so installation follows the standard ComfyUI custom node path: clone into ComfyUI/custom_nodes and install the declared dependencies. The pyproject.toml declares the package name comfyui-rmbg and the dependency list, and requirements.txt repeats it with transformers and diffusers added.
A git clone into the custom_nodes directory is the first step. The directory name only has to match what ComfyUI scans; the project's own name is ComfyUI-RMBG.
cd ComfyUI/custom_nodes
git clone https://github.com/1038lab/ComfyUI-RMBG
cd ComfyUI-RMBG
pip install -r requirements.txtThat requirements file pulls in huggingface-hub, transparent-background, segment-anything, groundingdino-py, opencv-python, onnxruntime, onnxruntime-gpu, protobuf pinned below 6.0.0, transformers and diffusers, plus hydra-core, omegaconf and iopath for SAM2 and decord, ftfy and typing_extensions for SAM3. Installing both onnxruntime and onnxruntime-gpu in the same environment is worth paying attention to, since the two packages can conflict depending on how your ComfyUI Python environment was built.
After restarting ComfyUI, the RMBG nodes appear in the node search. The project publishes example workflows in example_workflows/, and the README links a node overview image per release, so the fastest first run is to load one of those graphs rather than wiring nodes from scratch. The v2.9.4 notes describe SAM3 Segmentation arriving in that release, with a bug fix in v2.9.5, so if SAM3 is the reason you are installing, start from a workflow shipped after those versions.
Models are fetched through huggingface-hub according to the dependency list. The README does not spell out a manual download directory, so check the project homepage before assuming models are bundled.
Where ComfyUI-RMBG gets in the way
The dependency list is the first real constraint. groundingdino-py, segment-anything and transparent-background are separate packages with their own build requirements, and onnxruntime plus onnxruntime-gpu installed together is a known source of environment friction. On a ComfyUI install that already has a curated Python environment, this is the step most likely to fail.
Model weight size is the second constraint. Eleven model families are listed, and each one is downloaded and loaded separately. Running a BiRefNet matting node and a SAM3 segmentation node in the same graph means both are resident at once. The README gives no memory guidance, so the practical ceiling depends on your GPU.
The third constraint is that this is a GPL-3.0 project. If you are building a product around ComfyUI and linking this node pack into a distributed application, the licence is a factor to review rather than assume away. Nothing in the README describes an exception or a commercial licence.
Finally, version churn is visible. The release notes run from v2.2.0 in April 2025 to v3.1.0 in July 2026, with node renames and behavior changes along the way, including SAM3 fixes one day after SAM3 landed. A workflow saved against one version may not load cleanly against another. The README does not document a rollback procedure.
ComfyUI-RMBG against rembg and transparent-background
The obvious comparison is rembg, the standalone background removal library, or transparent-background, which ComfyUI-RMBG itself depends on. Those tools take an image and return a cutout. They are libraries or CLI tools, and they are the right choice when all you need is a mask file.
The difference in approach is that ComfyUI-RMBG does not try to be a better cutout than rembg. It moves the cutout into the graph. A mask produced by a BiRefNet node can be resized by ImageMaskResize, combined by Mask Combiner, previewed by MaskOverlay, and then fed to an inpainting sampler, all without writing an intermediate file. rembg has no concept of a graph, no text-prompted segmentation, and no GroundingDINO path.
The trade-off runs the other way too. rembg installs as a single Python package and runs from a command line. ComfyUI-RMBG requires a running ComfyUI instance, a GPU environment, and the full dependency tree. If your pipeline is a batch script over a folder of product photos, rembg is the smaller and more predictable tool.
Maintenance, versions and the GPL-3.0 licence
The repository is not archived, and the last push was on 2026-08-21, which is recent. The release history in the README shows a steady cadence: v2.2.0 in April 2025, v2.8.0 in August 2025 with the SAM2Segment node, v2.9.0 in August 2025 with the SDMatte Matting node, v2.9.4 in November 2025 with SAM3 Segmentation, v3.0.0 on 2026-01-01, and v3.1.0 on 2026-07-21 adding the Lucida model and a sensitivity parameter to the BiRefNet node.
Upgrade cost is not zero. The v3.0.0 and v3.1.0 releases changed the node set, and the README links update.md for details rather than summarizing them inline. A workflow built on v2.9.x nodes should be checked against update.md before upgrading, and the README does not describe a downgrade path.
The licence is GPL-3.0, declared in pyproject.toml as a file reference to LICENSE. For local ComfyUI use this is unremarkable. For anyone redistributing a modified version or embedding the nodes in a larger distributed application, GPL-3.0 carries obligations that a permissive licence would not, and the repository states no alternative licensing terms. That is a question for your own legal review, not something the README answers.
Editorial conclusion
Adopt ComfyUI-RMBG if you already run ComfyUI and want segmentation as a node instead of a separate tool, and you accept a GPL-3.0 licence plus a heavy dependency set (onnxruntime and onnxruntime-gpu, groundingdino-py, segment-anything, hydra-core). Skip it if you only need one clean cutout per image, since a single-purpose background removal service or library will be lighter. Before committing, check the model download path on the project homepage, confirm your ComfyUI Python environment can build groundingdino-py, and read update.md to see how the node set changed between v2.9.x and v3.1.0.
Frequently asked questions
How do I install ComfyUI-RMBG?
Clone the repository into ComfyUI/custom_nodes and install the declared dependencies with pip install -r requirements.txt, then restart ComfyUI. The requirements file includes onnxruntime and onnxruntime-gpu, plus groundingdino-py, segment-anything and hydra-core for the SAM2 and SAM3 paths.
Which models does ComfyUI-RMBG support?
The README lists RMBG-2.0, INSPYRENET, BEN, BEN2, BiRefNet, Lucida, SDMatte, SAM, SAM2, SAM3 and GroundingDINO. BiRefNet gained the Lucida fine-tune and a sensitivity parameter in v3.1.0.
Does ComfyUI-RMBG include example workflows?
Yes. The repository has an example_workflows/ directory, and the README links a node overview image for several releases, including a V3.0.0 nodes image. Loading a shipped workflow is the quickest way to see which nodes a given model needs.
What licence does ComfyUI-RMBG use?
GPL-3.0. The pyproject.toml declares the licence as a file reference to LICENSE, and no alternative or commercial licence is described in the repository.
Community notes