mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b0d4b3149 | ||
|
|
f0f3d419f8 | ||
|
|
26e2036388 | ||
|
|
22f5d028a2 |
79
README.md
79
README.md
@@ -28,13 +28,13 @@
|
||||
|
||||
---
|
||||
|
||||
https://github.com/user-attachments/assets/0f557d87-fd5e-422b-ab7e-dbdd4cab156c
|
||||
https://github.com/user-attachments/assets/90fffb9a-dae2-4d19-aca2-5d47600f0a01
|
||||
|
||||
https://github.com/user-attachments/assets/9c7ce1de-873b-4a3b-8579-0fc67642af3a
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
- **Freeform Inpainting Area:** Draw any custom (non-rectangular) area directly inside the image for inpainting. The tool generates content that is coherent with the rest of the image, without requiring a brush.
|
||||
- **Freeform Inpainting Area:** Draw any custom (like a polygonal lasso tool) area directly inside the image for inpainting. The tool generates content that is coherent with the rest of the image, without requiring a brush.
|
||||
- **Persistent & Stateful:** Your work is automatically saved to the browser's IndexedDB, preserving your full canvas
|
||||
state (layers, positions, etc.) even after a page reload.
|
||||
- **Multi-Layer Editing:** Add, arrange, and manage multiple image layers with z-ordering.
|
||||
@@ -71,16 +71,67 @@ https://github.com/user-attachments/assets/9c7ce1de-873b-4a3b-8579-0fc67642af3a
|
||||
3. Start up ComfyUI.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Polygonal Lasso Inpainting Workflow
|
||||
|
||||
LayerForge'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.
|
||||
|
||||
### Setup Requirements
|
||||
|
||||
1. **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.
|
||||
|
||||
2. **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).
|
||||
|
||||
### How to Use Polygonal Selection
|
||||
|
||||
1. **Start Drawing:** Hold `Shift + S` and left-click to place the first point of your polygonal selection.
|
||||
|
||||
2. **Add Points:** Continue left-clicking to place additional points. Each click adds a new vertex to your polygon.
|
||||
|
||||
3. **Close Selection:** Click back on the first point (or close to it) to complete and close the polygonal selection.
|
||||
|
||||
4. **Run Inpainting:** Once your selection is complete, run your inpainting workflow as usual. The generated content will seamlessly integrate with the existing image.
|
||||
|
||||
### Advanced Shape Mask Options
|
||||
|
||||
When using custom shapes, LayerForge provides several options to fine-tune the mask quality:
|
||||
|
||||
- **Mask Expansion/Contraction:** Adjust the mask boundary by -300 to +300 pixels to ensure better blending
|
||||
- **Edge Feathering:** Apply 0-300px feathering to create smooth transitions and reduce visible seams
|
||||
- **Output Area Extension:** Extend the output area in all directions for more context during generation
|
||||
- **Manual Blend Menu:** Right-click to access manual color adjustment tools for perfect edge blending
|
||||
|
||||
### Tips for Best Results
|
||||
|
||||
* Use **feathering (10–50px)** depending on the **size of the image** to create smooth transitions between the inpainted area and existing content. Larger images generally benefit from more feathering.
|
||||
* Experiment with **mask expansion** (e.g., 10–20px) if you notice hard edges or visible seams.
|
||||
* 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.
|
||||
* The model uses the area within the **dashed white preview outline** as the **full context** during generation.
|
||||
* Make sure the dashed region covers enough surrounding content to preserve lighting, texture, and scene coherence.
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Workflow Example
|
||||
|
||||
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**
|
||||
|
||||

|
||||
### 🔹 Simple Test 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.
|
||||

|
||||
|
||||
|
||||

|
||||
### 🔹 Flux Inpainting Workflow
|
||||
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.
|
||||

|
||||
|
||||
|
||||
|
||||
@@ -89,7 +140,6 @@ Click on the image above, then drag and drop it into your ComfyUI workflow windo
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 🎮 Controls & Shortcuts
|
||||
|
||||
### Canvas Control
|
||||
@@ -100,7 +150,7 @@ Click on the image above, then drag and drop it into your ComfyUI workflow windo
|
||||
| `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 shape for output area |
|
||||
| `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 |
|
||||
@@ -151,6 +201,14 @@ Click on the image above, then drag and drop it into your ComfyUI workflow windo
|
||||
| **Clear Mask** | Remove the entire mask |
|
||||
| **Exit Mode** | Click the "Draw Mask" button again |
|
||||
|
||||
---
|
||||
|
||||
## 🤖 Model Compatibility
|
||||
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
## 🧠 Optional: Matting Model (for image cutout)
|
||||
|
||||
The "Matting" feature allows you to automatically generate a cutout (alpha mask) for a selected layer. This is an
|
||||
@@ -165,7 +223,8 @@ optional feature and requires a model.
|
||||
|
||||
---
|
||||
|
||||
## 🐞 Known Issue:
|
||||
## 🔧 Troubleshooting
|
||||
|
||||
### `node_id` not auto-filled → black output
|
||||
|
||||
In some cases, **ComfyUI doesn't auto-fill the `node_id`** when adding a node.
|
||||
@@ -189,5 +248,9 @@ This project is licensed under the MIT License. Feel free to use, modify, and di
|
||||
|
||||
---
|
||||
|
||||
## 🙏 Acknowledgments
|
||||
|
||||
Based on the original [**Comfyui-Ycanvas**](https://github.com/yichengup/Comfyui-Ycanvas) by yichengup. This fork
|
||||
significantly enhances the editing capabilities for practical compositing workflows inside ComfyUI.
|
||||
|
||||
Special thanks to the ComfyUI community for feedback, bug reports, and feature suggestions that help make LayerForge better.
|
||||
|
||||
BIN
example_workflows/LayerForge_flux_fill_inpaint_example.jpg
Normal file
BIN
example_workflows/LayerForge_flux_fill_inpaint_example.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
@@ -622,8 +622,8 @@
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"cnr_id": "Comfyui-Ycanvas",
|
||||
"ver": "3941104bd59dd79c19d612da1b11c05d87c2ed1c",
|
||||
"cnr_id": "layerforge",
|
||||
"ver": "22f5d028a2d4c3163014eba4896ef86810d81616",
|
||||
"Node name for S&R": "CanvasNode",
|
||||
"widget_ue_connectable": {}
|
||||
},
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.0 MiB |
BIN
example_workflows/LayerForge_test_simple_workflow.jpg
Normal file
BIN
example_workflows/LayerForge_test_simple_workflow.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
@@ -241,8 +241,8 @@
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"cnr_id": "Comfyui-Ycanvas",
|
||||
"ver": "f6a491e83bab9481a2cac3367541a3b7803df9ab",
|
||||
"cnr_id": "layerforge",
|
||||
"ver": "22f5d028a2d4c3163014eba4896ef86810d81616",
|
||||
"Node name for S&R": "CanvasNode",
|
||||
"widget_ue_connectable": {}
|
||||
},
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 939 KiB |
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "layerforge"
|
||||
description = "Photoshop-like layered canvas editor to your ComfyUI workflow. This node is perfect for complex compositing, inpainting, and outpainting, featuring multi-layer support, masking, blend modes, and precise transformations. Includes optional AI-powered background removal for streamlined image editing."
|
||||
version = "1.5.0"
|
||||
version = "1.5.1"
|
||||
license = { text = "MIT License" }
|
||||
dependencies = ["torch", "torchvision", "transformers", "aiohttp", "numpy", "tqdm", "Pillow"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user