ComfyUI Node

RemBG v1.4

Cutouts without the model downloads

By Runware·Created 2 years ago·Updated about a month ago· 140
RemBG v1.4
  • image
  • image
settings.alphaMattingfalse
settings.alphaMattingBackgroundThreshold10
settings.alphaMattingErodeSize10
settings.alphaMattingForegroundThreshold240
settings.postProcessMaskfalse
settings.returnOnlyMaskfalse
ttlfalse
ttl_value60
outputFormatJPG
outputQuality95
advanced_json

rembg is the old reliable of background removal - the MIT-licensed tool that's been cutting subjects out of images since 2020, when a single r/StableDiffusion PSA about the A1111 extension was enough to take the operation mainstream. This node is the classic rembg v1.4 engine running as a hosted Runware endpoint: feed it an image, get a cutout back, and never download a u2net weight or load a model into VRAM.

If you already run local background removal - BiRefNet in ComfyUI core, or the Inspyrenet nodes - you don't need this; it's strictly slower to pay per image for what your GPU does free. But if you're on a laptop with no VRAM, or you want a background cutout in a cloud workflow where everything else already runs on Runware, this is the drop-in. It's also a nice second opinion node: when the local model mangles hair, rembg's u2net path sometimes disagrees usefully.

How it works

Your image (IMAGE tensor) is encoded to a PNG and sent to runware:109@1 with taskType: removeBackground. The result comes back as a native image output - the cutout on a transparent background when outputFormat is PNG, or composited onto whatever the format supports.

The inputs that make it interesting are the matting controls:

  • settings.alphaMatting - toggle on to refine edges instead of a hard cut. On for hair, fur, and anything with soft edges; off for clean, flat subjects where it only adds time.
  • settings.alphaMattingForegroundThreshold (default 240) and settings.alphaMattingBackgroundThreshold (default 10) - where the matting decides foreground ends and background begins. Higher background threshold removes more background but takes longer.
  • settings.alphaMattingErodeSize (default 10) - how much the edge is eroded to smooth the silhouette.
  • settings.postProcessMask - extra mask cleanup pass when the first cut is noisy.
  • settings.returnOnlyMask - output the mask instead of the composited cutout, which is handy when you want to feed a mask into an inpaint or a compositing step.

Output: image (IMAGE). The advanced_json field takes settings.rgba if you want to control alpha handling precisely.

Installing

Pack-wide, one install: ComfyUI Manager → search Runware → install → restart, or:

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

No model downloads - that's the entire pitch. API key from the Runware dashboard.

Gotchas

Remember what the community learned back in 2023: rembg handles simple backgrounds well and complex ones still need manual cleanup. Hair is the classic failure - that's what settings.alphaMatting is for, so don't skip it on subjects with flyaway strands. And remember the format trap: JPG has no alpha channel, so a cutout saved as JPG composites onto black (or whatever the encoder does with alpha). Set outputFormat to PNG when you want the transparent result. Since it's a paid call per image, it's worth keeping for the occasional cutout, not for batch-processing ten thousand product photos.

CategoryRunware/Image/runware

Inputs (12)

NameTypeDefaultDescription
imageIMAGE
settings.alphaMattingoptBOOLEANfalseEnable alpha matting to refine edges of the foreground object.
settings.alphaMattingBackgroundThresholdoptINT101–255Threshold used in alpha matting to refine background areas. Higher values remove more background but increase computation time.
settings.alphaMattingErodeSizeoptINT101–255Size of the erosion operation used to smooth the edges of the foreground object.
settings.alphaMattingForegroundThresholdoptINT2401–255Threshold used in alpha matting to distinguish foreground from background. Affects edge sharpness.
settings.postProcessMaskoptBOOLEANfalseEnable additional post-processing to improve mask accuracy.
settings.returnOnlyMaskoptBOOLEANfalseReturn only the mask instead of the processed image.
ttloptBOOLEANfalseEnable to set ttl. Off uses the model's default.
ttl_valueoptINT60Time-to-live (TTL) in seconds for generated content. Only applies when `outputType` is `URL`.
outputFormatoptCOMBOJPGFile format for the generated image.
outputQualityoptINT9520–99Compression quality of the output. Higher values preserve quality but increase file size.
advanced_jsonoptSTRINGOptional JSON merged into the request. For: settings.rgba

Outputs (1)

NameTypeDescription
imageIMAGE