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-generaland the default matte settings, then adjust one control at a time so you can see which change improves the edge. - Choose
background: Alphawhen you plan to place the subject over another image later. Choosebackground: Colorand setbackground_colorwhen you need a result against a specific solid color. - Lower
sensitivitybelow1.0when faint subject areas are missing. Check whether that also brings back unwanted background detail. - Use a small positive
mask_offsetif the cut-out clips the subject, or a small negative value if a rim of the original background remains. Addmask_blurgradually when the edge needs softening. - Try
refine_foregroundfor 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
modelselector and choose an option currently listed there. UseBiRefNet-generalif it is available and you do not need a different model.
Required image connection is missing
- Explanation:
imageis 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
imageisNoneor 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
backgroundis set toColor,IMAGEis RGB overbackground_color; it is not the RGBA transparent result. This is a configuration outcome, not an error message. - Solution: Set
backgroundtoAlphaand use theIMAGEoutput when you need transparency.
Subject disappears while the background remains
- Explanation:
invert_output: Trueis intended to keep the background instead of the subject. This is a configuration outcome, not an error message. - Solution: Set
invert_outputtoFalsefor a standard subject cut-out.
Cut-out edge is clipped, too broad, or too soft
- Explanation:
mask_offsetchanges the matte boundary, whilemask_blursoftens 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 adjustmask_offseta few pixels at a time. Increasemask_bluronly as much as the desired edge softness requires.
