ComfyUI Node

Background Remover

A quick rembg cutout with no API key — just know what it isn't

By rcsaquino·Created 3 years ago·Updated 2 years ago· 1
Background Remover
  • image
  • IMAGE
model

Need a transparent cutout of a product shot or a clean avatar and don't want to touch a web service? This node is the whole rembg library wrapped in two inputs. Feed it an image, pick a segmentation model, and you get back the subject on a transparent background. No API, no key, no account - it's all local, which is the whole point.

Two inputs, that's it:

  • image - any IMAGE from a Load Image, a VAE decode, whatever.
  • model - the dropdown with the real decision in it. Seven options, and they map directly to rembg's built-in weights: u2net (general-purpose, the default), u2netp (lightweight/faster), u2net_human_seg (optimized for people), u2net_cloth_seg (garment parsing), silueta (the u2net network at 43MB), and isnet-general-use / isnet-anime (sharper edges, with the anime variant for illustration).

The output is one IMAGE - the cutout with an alpha channel baked in (rembg returns RGBA and the node passes it through). Save it as a PNG to keep the transparency; a JPG silently drops the alpha and you'll get a black or white fill, depending.

Mechanically it's a straight rembg call: the source builds a session with rembg.new_session(model) and runs rembg.remove(), with the code credited in a comment to the older Jcd1230 rembg-comfyui-node. rembg is the MIT library that's been doing this since 2020, wrapping U-2-Net and ISNet weights behind one API. The author here exposes only image + model - none of rembg's fancier knobs (alpha matting, post-process, background colour) are surfaced.

Here's where people actually get burned, in order:

  1. The first run looks frozen. rembg downloads model weights from the web on first use - u2net is ~176MB and lands in a cache in your home directory. First run can sit there for a while, and it needs internet. It's not hung; let it finish.
  2. It's really a one-image node. The code squeezes the input down before processing; throw a batch of several images at it and it'll error rather than process them all. Loop it or feed one at a time.
  3. No mask comes out. The output is the cutout image, not a mask. If you wanted a mask for inpainting, this node doesn't give you one - you'd have to split the alpha out yourself downstream.
  4. The quality ceiling is u2net-class. And that's the honest review: u2net has been the "fast, cheap, good enough" option since 2020, and it shows on hard edges. Flyaway hair, fur, veils, glass - this model family has struggled with those forever. If your subject is solid and contrasts with the background, this is great and costs nothing to run (it'll even run on CPU). If you're fighting hair, switch to isnet-general-use, and if that's still not cutting it, that's not this node's failure mode - go grab BiRefNet (now in core ComfyUI) or InSPyReNet, which are the actual quality options.

Install is the pack standard:

cd ComfyUI/custom_nodes
git clone https://github.com/rcsaquino/comfyui-custom-nodes
# restart ComfyUI

Or ComfyUI Manager → search "comfyui-custom-nodes". This node is the reason the pack's requirements.txt pulls in rembg, which brings onnxruntime along with it - the one genuinely heavy dependency in the pack.

Natural spot in a workflow: the product-photography pipeline. Extract the product here, generate a new scene with Flux or SDXL, composite the cutout in, and match lighting with IC-Light. For that job - clean edges on a well-lit product against a plain background - this node is honestly plenty. It's the cheap, fast option that gets out of your way.

Categoryrcsaquino

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
modelCOMBO7 options: u2net, u2netp, u2net_human_seg, u2net_cloth_seg, silueta, isnet-general-use, +1

Outputs (1)

NameTypeDescription
IMAGEIMAGE