Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-BCNodes > BiRefNet Remove Background

ComfyUI Node: BiRefNet Remove Background

Class Name

BC_BiRefNetRemoveBackground

Category
BCNodes/mask
Author
0xbeycan (Account age: 0days)
Extension
ComfyUI-BCNodes
Latest Updated
2026-11-12
Github Stars
0.0K

How to Install ComfyUI-BCNodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-BCNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-BCNodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

BiRefNet Remove Background Description

Removes image backgrounds with BiRefNet matting, refining edges and outputting cut-outs and masks.

BiRefNet Remove Background:

BC_BiRefNetRemoveBackground uses BiRefNet matting to separate a subject from its background. It is useful when you want a cut-out for compositing, a subject placed over a solid color, or a matte you can adjust elsewhere in your workflow. You can soften or grow the subject boundary, keep the background instead of the subject, and refine edges for a cleaner transparent cut-out. The selected model is fetched from Hugging Face on first use and kept loaded between runs.

BiRefNet Remove Background Input Parameters:

image

The image to process, supplied through an IMAGE connection. This is a required input with no default value or numeric range. Connect the image containing the subject you want to separate from its background. If the supplied image batch is empty, the node returns empty outputs rather than a processed cut-out.

model

The BiRefNet matting model to use. This is a required selection with a default of BiRefNet-general. The available options come from the installed matting-model registry, so the source does not provide a fixed list to document. Your choice determines which model performs the separation; the selected model is fetched from Hugging Face on first use and retained between runs.

sensitivity

Controls how readily faint parts of the matte count as foreground. The default is 1.0; the minimum is 0.0, the maximum is 1.0, and the step is 0.01. At the default, the matte is not amplified by this setting. Lower values amplify it, which can help retain faint subject areas, though they may also make unwanted faint areas more noticeable.

mask_blur

Applies Gaussian blur to the matte edges, measured in pixels. The default and minimum are 0 (no added blur); the maximum is 64, in steps of 1. Increase it when a cut-out edge looks too sharp. Larger values soften the transition more broadly and can make the boundary less precise.

mask_offset

Grows or shrinks the matte boundary by approximately one pixel per step. The default is 0; the minimum is -20 and the maximum is 20, in steps of 1. Positive values grow the kept area, which can recover a subject edge that was cut too tightly. Negative values shrink it, which can help remove a visible rim of the original background.

invert_output

Switches which part of the image is kept. The default is False. Set it to True when you want to keep the background instead of the subject; leave it False for a conventional subject cut-out.

refine_foreground

Applies additional foreground refinement. The default is False. When enabled, it hardens the matte edge and scales the colors by the matte, with the stated aim of producing cleaner cut-outs on transparent output. Try it when transparent edges appear untidy, and compare both settings if your subject has fine or soft details.

background

Chooses how the processed image is presented. The options are Alpha and Color, with Alpha as the default. Alpha produces an RGBA image whose alpha channel uses the matte, allowing transparency. Color produces an RGB image over the solid color selected by background_color.

background_color

The solid color used when background is set to Color. Its default is #222222. No numeric minimum or maximum is specified; this is a COLOR value. Changing it lets you preview or produce the separated result against a chosen solid backdrop. It does not set the backdrop while background remains Alpha.

BiRefNet Remove Background Output Parameters:

IMAGE

The processed IMAGE result. With background set to Alpha, it is an RGBA image with the matte used as its alpha channel, so the removed area can be transparent. With background set to Color, it is an RGB image placed over background_color. Use this output for your finished cut-out or solid-background composite.

MASK

The matte as a MASK output. It represents the separation used to determine which area is kept, and is useful when you want to inspect or reuse that separation in another mask-based step. With invert_output enabled, the node is configured to keep the background rather than the subject. The node may omit building an unconnected output to avoid unnecessary work; connect this socket when you need the matte.

MASK_IMAGE

The matte presented as an RGB IMAGE. This provides an image-format version of the mask for workflows that expect an IMAGE connection rather than a MASK connection. Its content represents the matte, not a separate background-removal pass. Connect it when you need that image-format representation; the node avoids building it when it is not linked.

BiRefNet Remove Background Usage Tips:

  • Start with BiRefNet-general and the default matte settings, then adjust one control at a time so you can see which change improves the edge.
  • Choose background: Alpha when you plan to place the subject over another image later. Choose background: Color and set background_color when you need a result against a specific solid color.
  • Lower sensitivity below 1.0 when faint subject areas are missing. Check whether that also brings back unwanted background detail.
  • Use a small positive mask_offset if the cut-out clips the subject, or a small negative value if a rim of the original background remains. Add mask_blur gradually when the edge needs softening.
  • Try refine_foreground for untidy transparent edges, especially when producing an alpha cut-out. Compare the result with it off before settling on a setting for fine details.
  • Connect only the outputs you need. The node is designed to avoid building certain unconnected image outputs, which can reduce unnecessary processing.

BiRefNet Remove Background Common Errors and Solutions:

Model download or loading failure

  • Explanation: The source specifies that the selected model is fetched from Hugging Face on first use. A download or loading problem can prevent processing; the provided node code does not specify an exact error-message string.
  • Solution: Check your connection to Hugging Face, confirm that the selected model is available to your installation, and retry. If it still fails, inspect the application log for the specific download or loading error.

Selected model is unavailable

  • Explanation: Model choices come from the installed matting-model registry. A workflow referring to a model that your current installation does not offer may fail to validate or run; the exact message is not specified in the provided source.
  • Solution: Open the model selector and choose an option currently listed there. Use BiRefNet-general if it is available and you do not need a different model.

Required image connection is missing

  • Explanation: image is required. Without a valid IMAGE connection, the node cannot perform background removal; the exact validation message depends on the host and is not specified here.
  • Solution: Connect an IMAGE output containing your source artwork to image, then run the workflow again.

Empty image input produces no processed images

  • Explanation: If image is None or its batch contains zero images, the node explicitly returns empty IMAGE, MASK, and MASK_IMAGE results rather than processing a picture.
  • Solution: Check the upstream image-loading or generation step and make sure it supplies at least one image.

Output has a solid background instead of transparency

  • Explanation: When background is set to Color, IMAGE is RGB over background_color; it is not the RGBA transparent result. This is a configuration outcome, not an error message.
  • Solution: Set background to Alpha and use the IMAGE output when you need transparency.

Subject disappears while the background remains

  • Explanation: invert_output: True is intended to keep the background instead of the subject. This is a configuration outcome, not an error message.
  • Solution: Set invert_output to False for a standard subject cut-out.

Cut-out edge is clipped, too broad, or too soft

  • Explanation: mask_offset changes the matte boundary, while mask_blur softens it. Extreme settings can make an otherwise usable separation look inaccurate; this is a result-quality issue rather than a specified error message.
  • Solution: Reset both to 0, then adjust mask_offset a few pixels at a time. Increase mask_blur only as much as the desired edge softness requires.

BiRefNet Remove Background Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-BCNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

BiRefNet Remove Background