Nodes/ComfyUI_BEN_ll/RembgByBenAdvanced
ComfyUI Node

RembgByBenAdvanced

The same BEN cutout, every knob exposed

By lldacing·Created 2 years ago·Updated about a year ago· 4
RembgByBenAdvanced
  • model
  • images
  • image
  • mask
width1024
height1024
upscale_methodbilinear
blur_size91
blur_size_two7
fill_colorfalse
color0
mask_threshold0.000

RembgByBenAdvanced is RembgByBen with the training wheels off. Same two-step pipeline - BEN mask, then blur-fusion foreground color estimation - but nothing is hidden behind defaults, which means you can fix the cases where the one-click version isn't good enough.

Under the hood, and it's worth knowing because it explains the interface: this class literally inherits from GetMaskByBen and BlurFusionForegroundEstimation, and its single function calls both in order. Every input you see belongs to one of those two steps.

  • Segmentation side: width / height (1024) - the preprocess resolution the model sees; does not affect the final output size. upscale_method (bilinear) - interpolation used for the preprocessed image and the mask resize. mask_threshold (0) - set above 0 to zero out low-confidence pixels and scrub floating noise off the mask.
  • Foreground side: blur_size (91) and blur_size_two (7) - the coarse and fine blur radii for the Photoroom fast-foreground-estimation defringing. fill_color (false) and color (0–16777215, i.e. 0xFFFFFF) - flip fill_color on to replace transparency with a solid RGB background instead.

Outputs: image (the RGBA cutout, or solid-background if you filled) and mask.

When do you actually need the knobs? A few honest cases:

  • Small or low-res subject: drop width/height to 512. The 1024 default is overkill and just slows you down.
  • Hair with a grey fringe that won't die: lower blur_size from 91 toward ~31 so the halo removal doesn't smear the fine strands.
  • A mask full of specks: nudge mask_threshold up to ~0.02–0.05 and watch the preview. Too high and you'll eat the soft edges.
  • Product mockup on a coloured backdrop: fill_color on, color set to your brand hex.

Install and model situation are shared with the whole pack: clone, pip install -r requirements.txt, restart ComfyUI, and put BEN_Base.pth or BEN2_Base.pth in ComfyUI/models/rembg/ben/ - nothing auto-downloads, and the filename decides BEN vs BEN2 (see LoadRembgByBenModel).

My take: run RembgByBen first. If the output is clean, you never needed this node. The moment you hit a fringe you can't explain, switch to this and start turning dials. The defaults are sane, but they're not magic - this is where a background-removal workflow actually gets tuned.

Categoryrembg/Ben

Inputs (10)

NameTypeDefaultDescription
modelBEN
imagesIMAGE
widthINT10240–16384The width of the pre-processing image, does not affect the final output image size
heightINT10240–16384The height of the pre-processing image, does not affect the final output image size
upscale_methodCOMBObilinearInterpolation method for pre-processing image and post-processing mask
blur_sizeINT911–255
blur_size_twoINT71–255
fill_colorBOOLEANfalse
colorINT00–16777215
mask_thresholdFLOAT0.0000–1

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK