中文

LayerForge: ComfyUI node for image compositing

LayerForge is a ComfyUI node for compositing images with multiple layers, masks, blend modes, and transformations.

Verified

Core facts

Read by a script from the official API, not rewritten by a model.

License
MIT
Languages
JavaScript
Maintainer
Azornes
Verified

What it is

LayerForge is a ComfyUI node for compositing images with multiple layers, masks, blend modes, and transformations. LayerForge stores canvas state in the browser's IndexedDB and returns an IMAGE plus a MASK to downstream nodes. LayerForge is based on the original Comfyui-Ycanvas by yichengup. LayerForge is licensed under the MIT License.

Main features

  1. LayerForge stores layers, positions, masks, and other canvas data in the browser's IndexedDB so the state survives a page reload.

  2. LayerForge can add, reorder, move, scale, and rotate multiple image layers.

  3. LayerForge can paint masks with adjustable brush size, strength, and softness.

  4. LayerForge offers 12 blend modes, including Overlay and Multiply, and sets opacity for each layer from the context menu.

  5. LayerForge can add files by drag and drop, paste images or internal layer selections from the clipboard, or import the latest ComfyUI output with one click.

  6. In its optional matting feature, LayerForge can generate a background-removal mask for a selected layer with ComfyUI's native BiRefNet loader or local BRIA RMBG 2.0.

Getting started

  1. To install, search for Comfyui-LayerForge in ComfyUI-Manager and click the Install button.

  2. For a manual install, clone this repo into custom_nodes.

  3. In the polygonal lasso inpainting workflow, enable auto_refresh_after_generation on the LayerForge node.

  4. LayerForge's polygonal inpainting selection lets you draw a closed shape for an inpainting area.

  5. Hold Shift, press S, and left-click to place the first point.

  6. Click the first point or click near it to close the shape.

From the README · bash
    cd ComfyUI/custom_nodes/
    git clone https://github.com/Azornes/Comfyui-LayerForge.git

Who it is for

Connecting a ComfyUI Batch Image node imports multiple images as separate layers. LayerForge has an optional MASK input. The IMAGE output is the flattened composite from the visible layer stack.

The MASK output is a combined alpha mask for the visible layers. LayerForge outputs standard ComfyUI IMAGE and MASK values. The matting feature is optional and requires a model.

The BRIA RMBG 2.0 model requires the transformers package in the active ComfyUI environment. LayerForge uses ComfyUI's native loader for BiRefNet. The lite-* variants do not work with this loader.

The mask threshold in the matting settings is set from 0 to 1. With the Expand/Contract mask option enabled, the boundary is set from -300 to +300 px. With the Feather edges option enabled, the feather amount is set from 0 to 300 px.

The Extend output area option extends the output area by up to 500 px on each side without changing the custom shape. The Flux Inpainting workflow combines LayerForge with Flux fill inpainting. The simple test workflow tests the node without a model-based generation step.

If LayerForge produces a black or empty output, check the node_id.

Sources

This page is written from the official sources below. Open them to check the original text.

Verified ·

This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.