Bria Replace Background
Swap an image's background in one node — Bria Replace Background, no local model needed
- images
- ref_images
- output_images
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
imagesandapi_keyare 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, orhigh_control. This is the speed/quality tradeoff:fastfor quick tests,high_controlwhen 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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| api_key | STRING | BRIA_API_TOKEN | — |
| modeopt | COMBO | base | 3 options: base, fast, high_control |
| promptopt | STRING | — | |
| ref_imagesopt | IMAGE | — | |
| refine_promptopt | BOOLEAN | true | — |
| enhance_ref_imagesopt | BOOLEAN | true | — |
| original_qualityopt | BOOLEAN | false | — |
| negative_promptopt | STRING | — | |
| seedopt | STRING | 681794 | — |
| visual_output_content_moderationopt | BOOLEAN | false | — |
| prompt_content_moderationopt | BOOLEAN | false | — |
| force_background_detectionopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| output_images | IMAGE | — |