Nodes/Comfyui_LG_Tools/InSPyReNet Rembg
ComfyUI Node

InSPyReNet Rembg

Cut out the subject, keep the mask, pick a backdrop

By LAOGOU-666·Created 2 years ago·Updated 7 months ago· 369
InSPyReNet Rembg
  • model
  • image
  • IMAGE
  • MASK
threshold0.50
background_color

InspyrenetRembgProcess is the half of the InSPyReNet pair that actually does the work. Give it a loaded model and an image, and it returns the subject cut out on transparency and the mask that did the cutting - which is more useful than it sounds, because the mask is the part you'll reuse. A cutout is a one-off; a mask feeds compositing, inpainting, or a background swap.

This is a real, no-nonsense background remover in the same pack as the toy-like interactive nodes. It's the "InSPyReNet, zero API keys" path that the KB's background-removal doc describes - the network that's been trading punches with BiRefNet for the quality crown, where BiRefNet is the default recommendation but InSPyReNet keeps winning on specific material. On hair and fur, in particular, it's genuinely good, and it has a decent shot at being better than the u2net your memory of rembg is stuck on.

How it works

You must feed it the INSPYRENET_MODEL output from InspyrenetRembgLoader - the loader and process node are a strict pair, and the model type is a custom type, so ComfyUI won't let you plug anything else in. It then runs the model over your image, gets the alpha channel, and returns:

  • IMAGE - the cutout. With no background color set, this is RGBA (transparent). With a color set, it's composited onto that solid color and returned as RGB.
  • MASK - the alpha channel as a proper ComfyUI mask, ready for compositing or inpainting nodes.

The two settings to know:

  • threshold (FLOAT, 0–1, default 0.5) - how aggressively pixels get classified as background. Lower it if the remover is eating wispy details or soft edges; raise it if background bleed is sneaking into the subject.
  • background_color (STRING, default empty) - leave empty for a transparent RGBA cutout, or type a color (hex like #FFFFFF or a name like white) to flatten onto a solid backdrop and get an RGB image. Handy for product shots or when whatever you're compositing onto can't handle alpha.

A note on the output quirk

Watch the channel counts. Empty background color returns an RGBA image and a mask that duplicates its alpha - fine for most pipelines, but it bites people who pipe the "IMAGE" straight into a node expecting RGB. If something downstream chokes on four channels, set a background color (or add a step that drops alpha).

Installing it

Part of Comfyui_LG_Tools:

cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/Comfyui_LG_Tools.git
pip install -r requirements.txt

Or via ComfyUI Manager → search "Comfyui_LG_Tools" → restart. It needs the transparent-background dependency, which the pack's requirements installs, and the model auto-downloads on the loader's first run.

Common issues

  • "Node not found / model type mismatch." You need the loader node from the same pack upstream. It won't accept a model from another rembg pack.
  • First run downloads. The checkpoint pulls from GitHub Releases once. If it stalls, it's the network, not you.
  • Threshold fiddling. The default 0.5 is fine for solid subjects; hair and semi-transparency want a lower threshold and a careful eye.

The honest verdict: for a one-stop cutout with a mask output and no API, this pair is hard to beat, and it's the most "serious" thing in the pack. Compare it against BiRefNet on your own images before you pick a side - the KB's advice is to run both on your three hardest cases and decide there.

Categoryimage

Inputs (4)

NameTypeDefaultDescription
modelINSPYRENET_MODEL
imageIMAGE
thresholdFLOAT0.500–1
background_colorSTRING

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK