Before you start
- source_image: The image whose subject you want to separate from its background. The selected graph loads the image through node 17 (LoadImage).
- background_removal_model: The selected resource names birefnet.safetensors. Its underlying loader is node 25 (LoadBackgroundRemovalModel), with input bg_removal_name.
Start with an image; receive a transparent cutout
Open Remove backgrounds with BiRefNet, version 0.1.1, and start at its exposed source_image input. The named result is Sweet Tea Preview Image, port output:18, supplied by node 18 (SweetTeaPreviewImage). The foreground mask stays inside the recipe; it is not a second output.
This is useful when you already have the subject image and need transparency for a layout or another compositing workflow. The recipe separates foreground from background; it does not create a replacement background.
Make the selected model available
The resource exposes background_removal_model; the selected graph binds model selection to bg_removal_name on node 25 (LoadBackgroundRemovalModel). That loader lists files registered under ComfyUI's background_removal model category, resolves the selected filename and loads it. A filename alone does not establish that the file contains a valid background-removal model.
Make birefnet.safetensors available in that model category before running. The current retained provider observation identifies background_removal/birefnet.safetensors at repository commit 25511f8787e51912e1480706b4e47b8f467fbf72. Its SHA-256 is 9ab37426bf4de0567af6b5d21b16151357149139362e6e8992021b8ce356a154 and its installation size is 444,473,596 bytes. Match the local file to that checksum; a registered filename alone does not prove a completed installation. These file facts establish exact setup identity, not GPU memory use or successful execution.
The preparation record describes a 1024 × 1024 standard configuration. It supplies no measured GPU memory, system memory or run duration, and establishes no supported platform or backend list. Those dimensions are workload context, not a demonstrated size limit or a capacity recommendation.
- Select birefnet.safetensors
- Node 25 resolves this filename from the background_removal model category and supplies the loaded model to node 24. Changing the filename changes the model used for segmentation; compatibility and comparative quality of other files are not established here.
birefnet.safetensors is unavailable in model selection or cannot be resolved.
The loader selects registered background_removal files and resolves the selected filename before loading.
Check: A file-resolution problem occurs before a foreground mask can be generated.
Check that birefnet.safetensors is registered under the background_removal model category, that bg_removal_name selects it, and that the local file SHA-256 matches the retained provider observation.
The loader reports that the background model file is invalid.
How the foreground becomes transparency
Node 17 (LoadImage) supplies its image output to both node 24 (RemoveBackground) and node 22 (JoinImageWithAlpha). Node 25 supplies the model to node 24 through bg_removal_model. RemoveBackground calls the model's encode_image(image) and returns a foreground mask. This supports an explanation in terms of model-based segmentation; the retained source does not establish BiRefNet's internal architecture or preprocessing.
The graph routes that mask through node 23 (InvertMask) into node 22's alpha input. JoinImageWithAlpha itself subtracts its resized mask input from one before constructing RGBA. The inversion in the recipe therefore compensates for the join node's polarity: foreground coverage becomes visible alpha rather than making the foreground transparent. In the resulting image, alpha near one means opaque, alpha near zero means transparent, and intermediate values mean partial coverage.
The join implementation resizes the mask to the image dimensions using bilinear interpolation, takes the image's first three channels and appends alpha. At that stage, RGB comes from the loaded image rather than newly generated subject pixels. This is a stage-specific property, not a guarantee about original file bytes, an existing input alpha channel, later color conversions or exports. Segmentation errors can still hide wanted RGB pixels by assigning them low alpha.
Run the cutout recipe
Changing source_image changes both the image being segmented and the RGB image receiving alpha. The model selector is the documented adjustable model control. This selected graph exposes no threshold, feathering, mask-strength or edge-refinement parameter, so there is no supported numeric setting here for fixing a difficult boundary.
The steps below use the resource's exposed input name. The graph records node 17 as LoadImage but contains no named upload input in its inputs object, so the upload step does not invent a node-level input binding.
- Supply the image you want to cut out through the exposed source_image input.
Look for: The selected image feeds both foreground segmentation at node 24 and alpha joining at node 22.
- With the required background-removal model available and selected, run the recipe.
Look for: The graph generates an internal foreground mask and sends the image with alpha to Sweet Tea Preview Image.
Outputs: output:18
- Inspect Sweet Tea Preview Image at output:18 for missing subject areas, retained background and unwanted edge coverage before using the cutout.
Look for: You can decide whether the generated transparency separates the intended subject well enough for its destination.
Outputs: output:18
Use the result or address a mask problem
Use output:18 when the next workflow accepts an image with transparency. A mask-only consumer needs a different interface or an explicit graph adaptation: this recipe exports the joined image, not node 24's mask. Likewise, putting the subject over a new background requires a later compositing stage.
A visible background color in a viewer alone does not establish that alpha was lost; a viewer can display transparent pixels against its own background. The selected output contract labels the port as an image without specifying export format or downstream alpha handling. Choose a destination that supports alpha, and distinguish display behavior from actual alpha loss when diagnosing the handoff.
What does the next workflow need?
- An image cutout with transparency: Use Sweet Tea Preview Image at output:18 with an alpha-capable destination.
- A standalone segmentation mask: The selected recipe has no mask output port; use a workflow that explicitly exposes a mask or adapt the graph separately.Continue
- The subject on a replacement background: Use the cutout in a subsequent compositing workflow; background replacement is outside this recipe.
Parts of the subject disappear or background remains around it.
The generated mask determines coverage even though the join stage retains the loaded RGB channels.
Check: An incorrect boundary or coverage region is a segmentation problem, distinct from changing the subject's RGB content.
Inspect the affected region and, if available, try a source image with clearer subject separation. For targeted corrections, move to a workflow with explicit mask editing or refinement; this graph has no documented refinement control.
After adapting the graph, the background stays visible while the subject becomes transparent.
JoinImageWithAlpha inverts its alpha input internally; the selected recipe routes the foreground mask through InvertMask first.
Check: Reversed foreground/background visibility points to mask polarity rather than just an inaccurate edge.
Restore the selected chain: node 24 output 0 to node 23 mask, then node 23 output 0 to node 22 alpha. Do not bypass the recipe's inversion when supplying the generated foreground mask.
Recipes and setup
What you need
- Model files
- 0.4 GiB
Remaining hardware or download-size estimates are not available yet.
Where this approach stops
- A separately exposed mask output
- Background generation or replacement within this recipe
- Documented threshold, feathering or edge-refinement controls
- Measured GPU memory, system memory or runtime requirements
- Guaranteed preservation through subsequent export or compositing
