Run ComfyUI Easily with InstaSD

Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:

  • One-click deployment
  • Any model, any node
  • Powerful GPUs for rapid iteration
Get Started

BiRefNetRMBG

BiRefNetRMBG Node Documentation

Overview

The BiRefNetRMBG node is a custom node for ComfyUI that performs advanced background removal from images using various BiRefNet models. It is part of the ComfyUI-RMBG module, which leverages the capabilities of multiple background removal and segmentation models to enhance image editing workflows.

Features

  • Supports a variety of BiRefNet models for different purposes such as general image segmentation, high-resolution processing, and specialized tasks like human matting.
  • Offers configurations for processing resolution, mask blurring, and output inversion.
  • Allows users to choose between transparent (alpha) backgrounds or solid color backgrounds.
  • Provides options to refine foregrounds for better transparency handling.
  • Optimized for GPU acceleration when available.

Inputs

The BiRefNetRMBG node accepts the following inputs:

  • Image: The image that you want to process for background removal.
  • Model: The BiRefNet model variant to use. Options include models optimized for general use, specific resolutions, portrait processing, and more.
  • Optional Settings:
    • Mask Blur: Amount of blur to apply to mask edges to smooth jagged transitions.
    • Mask Offset: Adjusts mask boundaries to expand or shrink the detected regions.
    • Invert Output: Option to invert the mask and image output.
    • Refine Foreground: Option to enable Fast Foreground Colour Estimation for transparent background optimization.
    • Background: Choice between Alpha (transparent) or Color (custom background color).
    • Background Color: Custom color to use as background when Color is selected.

Outputs

The BiRefNetRMBG node generates the following outputs:

  • IMAGE: The processed image with the background removed or replaced.
  • MASK: A binary mask delineating the processed areas of the image.
  • MASK IMAGE: A mask image with potential alpha compositing, useful for visualization.

Usage in ComfyUI Workflows

The BiRefNetRMBG node can be integrated into ComfyUI workflows where precise background removal is needed, such as in fashion, portrait, or other creative photography projects. It can be used as either a standalone process or in combination with other nodes for more complex image editing tasks.

To use this node in a typical ComfyUI workflow:

  1. Load Image: Use a node or method to load your target image into the workflow.
  2. Select Model: Choose the BiRefNet model variant that fits your resolution and subject requirements.
  3. Adjust Settings: Configure optional parameters like mask blur, offset, and whether you want to invert outputs.
  4. Set Background: Decide if you want a transparent background or to apply a solid color. Choose the color if applicable.
  5. Process Image: Connect the node to the rest of your workflow to generate the desired outputs.
  6. Utilize Outputs: Use the generated images and masks in subsequent nodes for additional processing or export.

Special Features and Considerations

  • Model Selection: Different models vary in performance, speed, and suitability for specific tasks. Choose the one that best fits your image characteristics and output needs.
  • Resolution Handling: Models have default and maximum resolutions that affect processing speed and memory use. Adjust these based on your system's capabilities.
  • Foreground Refinement: Activating foreground refinement can yield better results with complex edges or transparency effects.
  • System Requirements: Optimized for systems with CUDA capability to leverage GPU acceleration. Performance may be limited on CPU-only systems.

When using the BiRefNetRMBG node, ensure that your environment meets the necessary prerequisites and system requirements listed in the installation guide. Additionally, model files are managed via Hugging Face, and automatic downloads may be needed on first use. Ensure network access is available during initial setup or manually download models as needed.