ComfyUI Extension: ComfyUI-Background-Edit

Authored by yondonfu

Created

Updated

16 stars

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

Custom Nodes (0)

    README

    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). |