Nodes Browser

ComfyDeploy: How ComfyUI-Background-Edit works in ComfyUI?

What is ComfyUI-Background-Edit?

ComfyUI nodes for editing background of images/videos with CUDA acceleration support.

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for ComfyUI-Background-Edit and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

ComfyUI-Background-Edit

ComfyUI-Background-Edit is a set of ComfyUI nodes for editing background of images/videos with CUDA acceleration support.

Supported use cases:

  • Background blurring
  • Background removal
  • Background swapping

The CUDA accelerated nodes can be used in real-time workflows for live video streams using comfystream.


Install

Prererquisites

The recommended installation method is to use the Comfy Registry.

Comfy Registry

These nodes can be installed via the Comfy Registry.

comfy node registry-install comfyui-background-edit

ComfyUI-Manager

These nodes can be installed via ComfyUI-Manager in the UI or via the CLI:

comfy node install comfyui-background-edit

Manual

These nodes can also be installed manually by copying them into your custom_nodes folder and then installing dependencies:

cd custom_nodes
git clone https://github.com/yondonfu/ComfyUI-Background-Edit
cd ComfyUI-Background-Edit
pip install -r requirements.txt

Example Real-Time Live Video Workflows

Prerequisites

The workflow (API format) can be used with comfystream to run real-time background blurring on a live video stream.

The workflow can also be saved and dropped into ComfyUI to load the workflow for further modifications.

Example Image Workflows

Prerequisites:

The following example workflows are applied to this input image:

input

The output images can be saved and dropped into ComfyUI to load the workflows that created them.

Background Blurring

depth-bg-blur-output

Background Removal

depth-bg-black-output

Background Swapping

depth-bg-blue-output

This output just shows the background being swapped to a solid blue color, but in theory the background could be any image of your choice!

Nodes

| Node | Description | | --------------- | ----------------------------------------------------------------------------------------------------------- | | BackgroundColor | Creates black/red/green/blue images with same dimensions as input images. | | Composite | Creates composites of input foreground images, background images and foreground masks (CPU/CUDA supported). | | GaussianBlur | Applies gaussian blur to input images (CPU/CUDA supported). |