ComfyUI Node

RembgByBen

The all-in-one BEN cutout node

By lldacing·Created 2 years ago·Updated about a year ago· 4
RembgByBen
  • model
  • images
  • image
  • mask

This is the node people actually mean when they install this pack. Two inputs in, a clean cutout out. RembgByBen is the one-stop version of the whole BEN pipeline, and if you only try one node from ComfyUI_BEN_ll, it's this one.

BEN (Background Erase Network) is PramaLLC's MIT-licensed segmentation model, and this pack is a community port of it - the author lldacing, with the README and code comments in Chinese. BEN sits in the crowded mid-tier of background removal. It's not the current default in this space (that's BiRefNet, which ComfyUI now ships in core), and it never got the hype of BEN2's follow-up, but it's fast, light on VRAM, and on a solid subject against a contrasting background it's plenty. What makes this node worth knowing is what it does after the mask.

Here's the pipeline, straight from the source: RembgByBen inherits from RembgByBenAdvanced, which chains two steps. First it runs the segmentation - your image is preprocessed to 1024×1024, passed through BEN, and the mask is resized back to the original dimensions. Then it applies Photoroom's fast-foreground-estimation trick to recover the true foreground color under soft edges. That second step is the difference between a cutout with grey fringes on hair and one that composites cleanly. The output image is RGBA - the background is made transparent, not just blacked out - and you also get the mask as a separate output.

Inputs you actually touch: model (the BEN object from LoadRembgByBenModel) and images. That's it - the defaults handle everything else. Outputs: image (the cutout with alpha) and mask (the hard mask), which wire into compositing, inpainting, or an IC-Light relight.

Install through ComfyUI Manager (search "ComfyUI_BEN_ll") or:

cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/ComfyUI_BEN_ll.git
cd ComfyUI_BEN_ll
pip install -r requirements.txt
# restart ComfyUI

The part that trips everyone: the model does not download itself. Grab BEN_Base.pth (or BEN2_Base.pth) from HuggingFace and drop it in ComfyUI/models/rembg/ben/. The loader reads that folder, and nothing happens until the file is there.

Troubleshooting: if LoadRembgByBenModel shows an empty model list, the .pth isn't in the folder. If the pack won't load at all with a module error, run pip install -r requirements.txt - timm is the real dependency (BEN is Swin-based), and cv2 gets imported at module load even though it's not in the requirements file, so a bare environment may also need pip install opencv-python.

Reach for RembgByBen when you just want the cutout and nothing else. Want control over preprocessing or the fringes? That's RembgByBenAdvanced, one level down in the same pack.

Categoryrembg/Ben

Inputs (2)

NameTypeDefaultDescription
modelBEN
imagesIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK