LayerForge is an advanced canvas node for ComfyUI, providing a Photoshop-like layer-based editing experience directly within your workflow. It extends the concept of a simple canvas with multi-layer support, masking, blend modes, precise transformations, and seamless integration with other nodes.
🔹 Quick Start | 🧩 Workflow Example | ⚠️ Known Issues
https://github.com/user-attachments/assets/90fffb9a-dae2-4d19-aca2-5d47600f0a01
https://github.com/user-attachments/assets/9c7ce1de-873b-4a3b-8579-0fc67642af3a
Overlay, Multiply, etc.) and adjust opacity on a per-layer
basis via a context menu.BiRefNet model.Run is triggered in ComfyUI. Comfyui-LayerForge in ComfyUI-Manager and click Install button.custom_nodes:
bash
cd ComfyUI/custom_nodes/
git clone https://github.com/Azornes/Comfyui-LayerForge.gitLayerForge's newest feature allows you to draw custom polygonal selection areas and run inpainting directly within ComfyUI. This brings Photoshop-like lasso tool functionality to your AI workflows.
Enable Auto-Refresh: In LayerForge's settings, enable auto_refresh_after_generation. Without this setting, the new generation output won't update automatically in the canvas.
Configure Auto-Apply (Optional): If you want the mask to be automatically applied after drawing the shape, enable the auto-apply shape mask option in the Custom Output Area menu (appears on the left when a custom shape is active).
Start Drawing: Hold Shift + S and left-click to place the first point of your polygonal selection.
Add Points: Continue left-clicking to place additional points. Each click adds a new vertex to your polygon.
Close Selection: Click back on the first point (or close to it) to complete and close the polygonal selection.
Run Inpainting: Once your selection is complete, run your inpainting workflow as usual. The generated content will seamlessly integrate with the existing image.
When using custom shapes, LayerForge provides several options to fine-tune the mask quality:
Use Output Area Extension based on image size:
Extend the output area in all directions to give the model more context during generation, especially for larger or more complex images.
If visible seams still appear in the inpainting results:
Use the Manual Blend Menu (right-click on the mask area) to access color and edge adjustment tools for precise fine-tuning and seamless integration.
Image placement behavior:
The generated or pasted image is automatically inserted into the area defined by the blue shape you draw.
For a quick test of LayerForge, you can try the example workflow provided below. It demonstrates a basic compositing setup using the node.
🔗 Download Example Workflow
This workflow allows quick testing of node behavior and output structures without requiring additional models or complex dependencies. Useful for inspecting how basic outputs are generated and connected.

This example shows a typical inpainting setup using the Flux model. It demonstrates how to integrate model-based fill with contextual generation for seamless content restoration.

How to load the workflow: Click on the image above, then drag and drop it into your ComfyUI workflow window in your browser. The workflow should load automatically.
| Action | Description |
|---|---|
Click + Drag |
Pan canvas view |
Mouse Wheel |
Zoom view in/out |
Shift + Click (background) |
Start resizing canvas area |
Shift + Ctrl + Click |
Start moving entire canvas |
Shift + S + Left Click |
Draw custom polygonal shape for output area |
Single Click (background) |
Deselect all layers |
Esc |
Close fullscreen editor mode |
Double Click (background) |
Deselect all layers |
| Action | Description |
|---|---|
Ctrl + C |
Copy selected layer(s) |
Ctrl + V |
Paste from clipboard (image or internal layers) |
Drag & Drop Image File |
Add image as a new layer |
| Action | Description |
|---|---|
Click + Drag |
Move selected layer(s) |
Ctrl + Click |
Add/Remove layer from selection |
Alt + Drag |
Clone selected layer(s) |
Right Click |
Show blend mode & opacity menu |
Mouse Wheel |
Scale layer (snaps to grid) |
Ctrl + Mouse Wheel |
Fine-scale layer |
Shift + Mouse Wheel |
Rotate layer by 5° |
Shift + Ctrl + Mouse Wheel |
Snap rotation to 5° increments |
Arrow Keys |
Nudge layer by 1px |
Shift + Arrow Keys |
Nudge layer by 10px |
[ or ] |
Rotate by 1° |
Shift + [ or ] |
Rotate by 10° |
Delete |
Delete selected layer(s) |
| Action | Description |
|---|---|
Drag Corner/Side |
Resize layer |
Drag Rotation Handle |
Rotate layer |
Hold Shift |
Keep aspect ratio / Snap rotation to 15° |
Hold Ctrl |
Snap to grid |
| Action | Description |
|---|---|
Click + Drag |
Paint on the mask |
Middle Mouse Button + Drag |
Pan canvas view |
Mouse Wheel |
Zoom view in/out |
| Brush Controls | Use sliders to control brush Size, Strength, and Softness |
| Clear Mask | Remove the entire mask |
| Exit Mode | Click the "Draw Mask" button again |
LayerForge is designed to work with any ComfyUI-compatible model. The node outputs standard image and mask data that can be used with any model or workflow. LayerForge automatically inserts the generated image into the exact shape and position you draw with the blue polygon tool — but only if the generated image is saved properly, for example via a Save Image node.
The "Matting" feature allows you to automatically generate a cutout (alpha mask) for a selected layer. This is an optional feature and requires a model.
- Model Name:
BiRefNetDownload from:
[Hugging Face](https://huggingface.co/ZhengPeng7/BiRefNet/tree/mai
$ claude mcp add Comfyui-LayerForge \
-- python -m otcore.mcp_server <graph>