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.
- ComfyUI-Background-Edit
- Install
- Example Real-Time Live Video Workflows
- Example Image Workflows
- Nodes
Prererquisites
- Install comfy-cli
The recommended installation method is to use the Comfy Registry.
These nodes can be installed via the Comfy Registry.
comfy node registry-install comfyui-background-edit
These nodes can be installed via ComfyUI-Manager in the UI or via the CLI:
comfy node install comfyui-background-edit
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
Prerequisites
- Install ComfyUI-Depth-Anything-Tensorrt.
- The example workflow uses TensorRT to accelerate DepthAnything2 to meet real-time requirements.
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.
Prerequisites:
- Install ComfyUI-DepthAnythingV2.
The following example workflows are applied to this input image:
The output images can be saved and dropped into ComfyUI to load the workflows that created them.
Background Blurring
Background Removal
Background Swapping
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!
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). |