|
1 | 1 | --- |
2 | 2 | title: Mask Editor - Create and Edit Masks in ComfyUI |
3 | | -description: Learn how to use the Mask Editor in ComfyUI, including settings and usage instructions |
| 3 | +description: Learn how to use the Mask Editor in ComfyUI, including tools, layers, settings, and shortcuts |
4 | 4 | sidebarTitle: "Mask Editor" |
5 | 5 | icon: "brush" |
| 6 | +mode: wide |
6 | 7 | --- |
7 | 8 |
|
8 | | -The Mask Editor is a very useful feature in ComfyUI that allows users to create and edit masks within images without needing to use other applications. |
| 9 | +The Mask Editor is a built-in tool in ComfyUI that lets you create and edit masks directly on your images — no external image editor needed. It supports multiple drawing tools, layer management, undo/redo, canvas transformations, and GPU-accelerated brush rendering. |
9 | 10 |
|
10 | | -The Mask Editor is currently triggered through the `Load Image` node. After uploading an image, you can right-click on the node and select `Open in MaskEditor` from the menu to open the Mask Editor. |
| 11 | +--- |
| 12 | + |
| 13 | +## How to Open |
| 14 | + |
| 15 | +There are three ways to open the Mask Editor: |
| 16 | + |
| 17 | +1. **Selection Toolbox** — Select a Load Image node, then click the Mask icon button in the selection toolbar above the node. |
| 18 | +2. **Image Overlay** — Hover over the image preview (gallery mode), then click the **Edit or mask image** button (mask icon) that appears in the top-left corner. |
| 19 | +3. **Right-Click Menu** — Right-click a Load Image node and select `Open in Mask Editor` from the context menu. |
| 20 | + |
| 21 | +> The Mask Editor is available in both **Graph Mode** and **App Mode**. |
| 22 | +
|
| 23 | + |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Interface Overview |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +The Mask Editor opens as a modal dialog with four main areas: |
| 32 | + |
| 33 | +| # | Area | Location | Description | |
| 34 | +|---|------|----------|-------------| |
| 35 | +| 1 | **Top Bar** | Top | Header with undo/redo, canvas transforms, invert/clear, save/cancel | |
| 36 | +| 2 | **Tool Panel** | Left | Tool selection and zoom info | |
| 37 | +| — | **Pointer Zone** | Center | The main canvas area for drawing and editing | |
| 38 | +| 3 | **Side Panel** | Right | Tool-specific settings and layer controls | |
11 | 39 |
|
12 | | - |
| 40 | +--- |
| 41 | + |
| 42 | +## Tools |
| 43 | + |
| 44 | +The tool panel on the left side offers five tools. Select a tool to activate it, and the right panel will show its settings. |
| 45 | + |
| 46 | +<img src="/images/interface/maskeditor/maskeditor_tool_panel.jpg" alt="Mask Editor tool panel with 5 numbered tools" style={{maxWidth: '300px'}} /> |
| 47 | + |
| 48 | +| # | Tool | Layer | Description | |
| 49 | +|---|------|-------|-------------| |
| 50 | +| 1 | **Mask Pen** | Mask | Primary tool for drawing mask regions. Left-click and drag to paint mask on the image. | |
| 51 | +| 2 | **Paint Pen** | RGB (Paint) | Paint directly onto the image's RGB layer. Useful for inpainting or touching up the base image. | |
| 52 | +| 3 | **Eraser** | Mask / RGB | Erase parts of an existing mask or paint layer. | |
| 53 | +| 4 | **Paint Bucket** | Mask | Flood-fill tool based on color similarity. Click a pixel to fill the connected region with a mask; click an already-masked area to erase from the mask. Tolerance controls how broadly the fill spreads. | |
| 54 | +| 5 | **Color Select** | Mask | Selectively mask all pixels matching a target color, with advanced matching algorithms (Simple HSL / LAB). |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## TopBar Actions |
| 59 | + |
| 60 | + |
13 | 61 |
|
14 | | - |
| 62 | +The top bar provides canvas-wide operations: |
15 | 63 |
|
16 | | -You can then click with your mouse on the image to create and edit masks. |
| 64 | +| # | Action | Description | |
| 65 | +|---|--------|-------------| |
| 66 | +| 1 | **Undo** (Ctrl+Z) | Revert the last action | |
| 67 | +| 2 | **Redo** (Ctrl+Shift+Z / Ctrl+Y) | Reapply a reverted action | |
| 68 | +| 3 | **Rotate Left** | Rotate all layers 90° counter-clockwise | |
| 69 | +| 4 | **Rotate Right** | Rotate all layers 90° clockwise | |
| 70 | +| 5 | **Mirror Horizontal** | Flip all layers horizontally | |
| 71 | +| 6 | **Mirror Vertical** | Flip all layers vertically | |
| 72 | +| 7 | **Invert** | Invert the mask (black ↔ white) | |
| 73 | +| 8 | **Clear** | Clear the entire mask | |
| 74 | +| 9 | **Save** | Save the mask and close the editor | |
| 75 | +| 10 | **Cancel** | Close without saving | |
| 76 | + |
| 77 | +> **Note**: Rotate and mirror operations affect all three layers (mask, paint, and base image) simultaneously. GPU-accelerated textures are recreated after transforms. |
| 78 | +
|
| 79 | +--- |
| 80 | + |
| 81 | +## Layers |
| 82 | + |
| 83 | +The right panel includes a **Layers** section where you can toggle visibility of each layer independently: |
| 84 | + |
| 85 | +- **Mask Layer**: The mask overlay. You can adjust its **opacity** and **blending mode**: |
| 86 | + - `Black` — Mask renders as black overlay |
| 87 | + - `White` — Mask renders as white overlay |
| 88 | + - `Negative` — Inverted mask rendering |
| 89 | +- **Paint Layer**: The RGB paint layer (visible when using Paint Pen) |
| 90 | +- **Base Image Layer**: The original source image |
| 91 | + |
| 92 | +Click **Activate Layer** on a layer to switch drawing focus to it. |
| 93 | + |
| 94 | +Refer to the main editor screenshot above — the right panel includes brush settings and the Layers section at the bottom. |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Brush Settings |
| 99 | + |
| 100 | +When a brush-based tool (Mask Pen, Paint Pen, or Eraser) is active, the side panel shows brush settings: |
| 101 | + |
| 102 | +| Setting | Range | Description | |
| 103 | +|---------|-------|-------------| |
| 104 | +| **Shape** | Arc / Rect | Round brush or square brush | |
| 105 | +| **Color** | Any hex color | The paint color (for Paint Pen) or mask color | |
| 106 | +| **Thickness** | 1–250 | Brush diameter in pixels | |
| 107 | +| **Opacity** | 0–1 | Brush stroke transparency | |
| 108 | +| **Hardness** | 0–1 | Edge softness. 1 = hard edge, 0 = very soft | |
| 109 | +| **Step Size** | 1–100 | Spacing between brush dabs. Lower values give smoother strokes | |
| 110 | + |
| 111 | +Use **Reset to Default** to restore the default brush parameters. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## Canvas Navigation & Shortcuts |
| 116 | + |
| 117 | +| Shortcut | Action | |
| 118 | +|----------|--------| |
| 119 | +| **Space + Drag** | Pan the canvas | |
| 120 | +| **Ctrl + Scroll** | Zoom in/out | |
| 121 | +| **Click zoom %** | Reset zoom to 100% | |
| 122 | +| **Ctrl + Z** | Undo | |
| 123 | +| **Ctrl + Shift + Z** or **Ctrl + Y** | Redo | |
| 124 | +| **Alt + Right-click + Drag** | Adjust brush: left/right changes **size**, up/down changes **hardness** | |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Settings |
| 129 | + |
| 130 | +In the ComfyUI Settings panel, you can configure the following Mask Editor options: |
| 131 | + |
| 132 | +| Setting | Category | Default | Description | |
| 133 | +|---------|----------|---------|-------------| |
| 134 | +| **Brush adjustment speed multiplier** | Mask Editor → Brush Adjustment → Sensitivity | 1.0 (0.1–2.0) | How quickly the brush size and hardness change when using Alt+Right-click drag | |
| 135 | +| **Lock brush adjustment to dominant axis** | Mask Editor → Brush Adjustment → Use Dominant Axis | On | When enabled, the adjustment affects only size OR hardness based on your dominant movement direction | |
| 136 | + |
| 137 | +--- |
17 | 138 |
|
18 | 139 | ## Video Tutorial |
19 | 140 |
|
20 | 141 | <video controls> |
21 | 142 | <source src="/images/interface/maskeditor/maskeditor.mp4" type="video/mp4"/> |
22 | 143 | Your browser does not support the video tag. |
23 | 144 | </video> |
| 145 | + |
| 146 | +> **Note**: This video demonstrates an older version of the Mask Editor (Nodes 1.0 UI) showing brush size adjustment and mask preview creation. The overall workflow remains the same in the current version. |
0 commit comments