Nodes/ComfyUI_BiRefNet_ll/RembgByBiRefNet
ComfyUI Node Runs on cloud

RembgByBiRefNet

Model in, transparent image out

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

This is the whole job in two inputs. Feed RembgByBiRefNet a loaded BiRefNet model and an image, and you get back a transparent cutout and the mask it was cut from. No width fields, no blur sliders, no threshold - you wire it up, queue it, and it's done.

Under the hood this node is RembgByBiRefNetAdvanced with every knob left at its default. In fact the class literally inherits from it and passes nothing through. So when you're using this node you're getting, silently:

  • 1024×1024 pre-processing (BiRefNet's native resolution for the standard weights),
  • the Photoroom fast-foreground-estimation pass that scrubs background colour out of semi-transparent edges (so hair doesn't come out with a coloured halo),
  • no mask thresholding, no background fill - true transparency out.

That combination is genuinely good, which is why it's the node most workflow-sharers use for a quick cutout.

When it's the right call

Reach for it when you have a solid subject, want a background-free image now, and don't need to fiddle. It's the fastest path from "image" to "PNG with alpha" in this pack, and BiRefNet's edge quality on hair, fur and fabric mesh is exactly why it replaced rembg's u2net as the default for that job.

When it's not the right call:

  • Your image is high-res (above ~1500px). The node silently pre-processes at 1024, so a 4K input loses the fine edges before the model ever sees it. You want RembgByBiRefNetAdvanced with General-HR or General-dynamic weights, or you'll be blaming the model for a downscale you didn't notice.
  • The subject is semi-transparent - glass, veils, smoke. A hard foreground/background split can't represent a half-transparent pixel, and this node uses the standard segmentation weights, not the Matting ones.
  • You need the mask and want to clean it up. The mask output is the raw soft alpha; if it's speckly, the Advanced node's mask_threshold is the fix.

Inputs and outputs

Just two inputs:

  • model - a BIREFNET handle from AutoDownloadBiRefNetModel or LoadRembgByBiRefNetModel.
  • images - your IMAGE tensor, batched or single.

Two outputs:

  • image - the foreground with background made transparent (RGBA). Wire it into anything that saves or composites.
  • mask - the soft MASK that was used to cut it. Handy if you want the cutout and the matte for separate jobs.

Install

Standard pack install - ComfyUI Manager (search ComfyUI_BiRefNet_ll) or:

cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/ComfyUI_BiRefNet_ll.git
cd ComfyUI_BiRefNet_ll
pip install -r requirements.txt   # numpy, opencv-python, timm
# restart ComfyUI

You still need a model. AutoDownloadBiRefNetModel will grab one on first run; or drop your own .safetensors files into models/BiRefNet and use LoadRembgByBiRefNetModel.

Common gotchas

  • Transparency looks fine on grey, wrong on a colour - that's the hard-mask limitation showing through on semi-transparent material. Switch to the Matting weights via RembgByBiRefNetAdvanced.
  • Edges still faintly haloed - the foreground-estimation defaults are decent, not magic. The Advanced node's blur_size is the control you're missing here.
  • Slow on big images - load the model with dtype: float16. Roughly half the VRAM, about twice the speed, no visible quality cost.

If this node feels too locked-down, that's by design - its sibling RembgByBiRefNetAdvanced exists specifically so you can reach into everything this one hides.

Categoryrembg/BiRefNet

Inputs (2)

NameTypeDefaultDescription
modelBIREFNET
imagesIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK