Nodes/BRIA AI API nodes/Bria Replace Background
ComfyUI Node

Bria Replace Background

Swap an image's background in one node — Bria Replace Background, no local model needed

By Bria-AI·Created 2 years ago·Updated 3 months ago· 95
Bria Replace Background
  • images
  • ref_images
  • output_images
api_keyBRIA_API_TOKEN
modebase
prompt
refine_prompttrue
enhance_ref_imagestrue
original_qualityfalse
negative_prompt
seed681794
visual_output_content_moderationfalse
prompt_content_moderationfalse
force_background_detectionfalse

Replacing a background is the classic two-step: cut the subject out, then generate a new backdrop behind it. Locally that means chaining a segmentation model (BiRefNet, rembg, whatever you prefer) into an inpainting pass, and you get to debug every seam yourself. This node does both steps in BRIA's cloud in one call - you hand it an image and a prompt (or reference image), it returns the composited result as a normal ComfyUI IMAGE tensor.

It's part of the official BRIA AI API nodes pack, so the actual work happens on BRIA's servers at engine.prod.bria-api.com. You don't need a single model file or any GPU VRAM for it - you do need a BRIA API token from platform.bria.ai. BRIA's models are trained exclusively on licensed data, which is why this shows up in eCommerce pipelines where "trained on scraped Pinterest images" would be a dealbreaker.

How it works

The image gets base64-encoded and POSTed to BRIA's /v2/image/edit/replace_background endpoint. The response includes a status_url, which the node polls until the job completes, then it downloads the result and returns it as an IMAGE tensor ready for the Save Image node. The RMBG happens first, then a generation pass fills the new background guided by your prompt or ref_images.

The inputs that matter

  • images and api_key are the only required ones. Feed it a single image or a batch.
  • prompt - describes the new background ("snowy mountain lake, golden hour", "clean white studio backdrop"). Leave it empty and the subject just gets cut out.
  • mode - base (default), fast, or high_control. This is the speed/quality tradeoff: fast for quick tests, high_control when the background placement really matters.
  • ref_images - instead of a text prompt, you can supply a reference image for the new background. enhance_ref_images (on by default) cleans up that reference first.
  • force_background_detection - flip this on when the model fails to find the subject on its own; it makes the pipeline lean harder on the segmentation step.
  • seed - defaults to "681794" and accepts comma-separated values for batch runs. Same seed = same background layout.

There's also negative_prompt and two content-moderation toggles if you need them.

Install

No requirements file, no model downloads - the pack only uses libraries ComfyUI already ships. Install via ComfyUI Manager (search "BRIA API") or:

cd path_to_comfyui/custom_nodes
git clone https://github.com/Bria-AI/ComfyUI-BRIA-API.git

Restart ComfyUI, then drop your token into api_key.

Where people get burned

The default key is the literal string BRIA_API_TOKEN and the node throws "Please insert a valid API key." until you replace it - the most common support complaint across the whole pack, and the easiest fix. Second: every call is a paid API request, and Replace Background runs a full segmentation plus a generation pass, so it's one of the pricier nodes in the pack. Batch your images (comma-separated seeds make it batch-safe) rather than iterating one at a time. And if your subject is blending into the new background, mode: high_control plus force_background_detection is the lever you're looking for before you give up on it.

CategoryAPI Nodes

Inputs (13)

NameTypeDefaultDescription
imagesIMAGE
api_keySTRINGBRIA_API_TOKEN
modeoptCOMBObase3 options: base, fast, high_control
promptoptSTRING
ref_imagesoptIMAGE
refine_promptoptBOOLEANtrue
enhance_ref_imagesoptBOOLEANtrue
original_qualityoptBOOLEANfalse
negative_promptoptSTRING
seedoptSTRING681794
visual_output_content_moderationoptBOOLEANfalse
prompt_content_moderationoptBOOLEANfalse
force_background_detectionoptBOOLEANfalse

Outputs (1)

NameTypeDescription
output_imagesIMAGE