Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 129 additions & 6 deletions interface/maskeditor.mdx
Original file line number Diff line number Diff line change
@@ -1,23 +1,146 @@
---
title: Mask Editor - Create and Edit Masks in ComfyUI
description: Learn how to use the Mask Editor in ComfyUI, including settings and usage instructions
description: Learn how to use the Mask Editor in ComfyUI, including tools, layers, settings, and shortcuts
sidebarTitle: "Mask Editor"
icon: "brush"
mode: wide
---

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

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

## How to Open

There are three ways to open the Mask Editor:

1. **Selection Toolbox** — Select a Load Image node, then click the Mask icon button in the selection toolbar above the node.
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.
3. **Right-Click Menu** — Right-click a Load Image node and select `Open in Mask Editor` from the context menu.

> The Mask Editor is available in both **Graph Mode** and **App Mode**.

![Three ways to open the Mask Editor: Selection Toolbox, Image Overlay, and Right-Click Menu](/images/interface/maskeditor/maskeditor_3ways_to_open_maskeditor.png)

---

## Interface Overview

![Mask Editor main interface with tool panel, canvas, and settings side panel](/images/interface/maskeditor/maskeditor_main_editor.jpg)

The Mask Editor opens as a modal dialog with four main areas:

| # | Area | Location | Description |
|---|------|----------|-------------|
| 1 | **Top Bar** | Top | Header with undo/redo, canvas transforms, invert/clear, save/cancel |
| 2 | **Tool Panel** | Left | Tool selection and zoom info |
| — | **Pointer Zone** | Center | The main canvas area for drawing and editing |
| 3 | **Side Panel** | Right | Tool-specific settings and layer controls |

![ComfyUI Mask Editor](/images/interface/maskeditor/maskeditor.jpg)
---

## Tools

The tool panel on the left side offers five tools. Select a tool to activate it, and the right panel will show its settings.

<img src="/images/interface/maskeditor/maskeditor_tool_panel.jpg" alt="Mask Editor tool panel with 5 numbered tools" style={{maxWidth: '300px'}} />

| # | Tool | Layer | Description |
|---|------|-------|-------------|
| 1 | **Mask Pen** | Mask | Primary tool for drawing mask regions. Left-click and drag to paint mask on the image. |
| 2 | **Paint Pen** | RGB (Paint) | Paint directly onto the image's RGB layer. Useful for inpainting or touching up the base image. |
| 3 | **Eraser** | Mask / RGB | Erase parts of an existing mask or paint layer. |
| 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. |
| 5 | **Color Select** | Mask | Selectively mask all pixels matching a target color, with advanced matching algorithms (Simple HSL / LAB).

---

## TopBar Actions

![Mask Editor TopBar actions labeled 1–10](/images/interface/maskeditor/maskeditor_topbar_actions.jpg)

![ComfyUI Mask Editor](/images/interface/maskeditor/maskeditor_ui.jpg)
The top bar provides canvas-wide operations:

You can then click with your mouse on the image to create and edit masks.
| # | Action | Description |
|---|--------|-------------|
| 1 | **Undo** (Ctrl+Z) | Revert the last action |
| 2 | **Redo** (Ctrl+Shift+Z / Ctrl+Y) | Reapply a reverted action |
| 3 | **Rotate Left** | Rotate all layers 90° counter-clockwise |
| 4 | **Rotate Right** | Rotate all layers 90° clockwise |
| 5 | **Mirror Horizontal** | Flip all layers horizontally |
| 6 | **Mirror Vertical** | Flip all layers vertically |
| 7 | **Invert** | Invert the mask (black ↔ white) |
| 8 | **Clear** | Clear the entire mask |
| 9 | **Save** | Save the mask and close the editor |
| 10 | **Cancel** | Close without saving |

> **Note**: Rotate and mirror operations affect all three layers (mask, paint, and base image) simultaneously. GPU-accelerated textures are recreated after transforms.

---

## Layers

The right panel includes a **Layers** section where you can toggle visibility of each layer independently:

- **Mask Layer**: The mask overlay. You can adjust its **opacity** and **blending mode**:
- `Black` — Mask renders as black overlay
- `White` — Mask renders as white overlay
- `Negative` — Inverted mask rendering
- **Paint Layer**: The RGB paint layer (visible when using Paint Pen)
- **Base Image Layer**: The original source image

Click **Activate Layer** on a layer to switch drawing focus to it.

Refer to the main editor screenshot above — the right panel includes brush settings and the Layers section at the bottom.

---

## Brush Settings

When a brush-based tool (Mask Pen, Paint Pen, or Eraser) is active, the side panel shows brush settings:

| Setting | Range | Description |
|---------|-------|-------------|
| **Shape** | Arc / Rect | Round brush or square brush |
| **Color** | Any hex color | The paint color (for Paint Pen) or mask color |
| **Thickness** | 1–250 | Brush diameter in pixels |
| **Opacity** | 0–1 | Brush stroke transparency |
| **Hardness** | 0–1 | Edge softness. 1 = hard edge, 0 = very soft |
| **Step Size** | 1–100 | Spacing between brush dabs. Lower values give smoother strokes |

Use **Reset to Default** to restore the default brush parameters.

---

## Canvas Navigation & Shortcuts

| Shortcut | Action |
|----------|--------|
| **Space + Drag** | Pan the canvas |
| **Ctrl + Scroll** | Zoom in/out |
| **Click zoom %** | Reset zoom to 100% |
| **Ctrl + Z** | Undo |
| **Ctrl + Shift + Z** or **Ctrl + Y** | Redo |
| **Alt + Right-click + Drag** | Adjust brush: left/right changes **size**, up/down changes **hardness** |

---

## Settings

In the ComfyUI Settings panel, you can configure the following Mask Editor options:

| Setting | Category | Default | Description |
|---------|----------|---------|-------------|
| **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 |
| **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 |

---

## Video Tutorial

<video controls>
<source src="/images/interface/maskeditor/maskeditor.mp4" type="video/mp4"/>
Your browser does not support the video tag.
</video>

> **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.
139 changes: 130 additions & 9 deletions ja/interface/maskeditor.mdx
Original file line number Diff line number Diff line change
@@ -1,25 +1,146 @@
---
title: マスクエディター - ComfyUI 内でマスクの作成と編集を行う
description: ComfyUI のマスクエディターの設定や使用方法を含め、その使い方について学びます
description: ComfyUI のマスクエディターの使い方を学びます。ツール、レイヤー、設定、ショートカットを網羅
sidebarTitle: "マスクエディター"
icon: "brush"
translationSourceHash: 3f296e3a
translationFrom: interface/maskeditor.mdx, zh/interface/maskeditor.mdx
mode: wide
---

マスクエディターは、他のアプリケーションを使用せずに画像内でマスクを作成および編集できる、ComfyUI の非常に便利な機能です
マスクエディターは ComfyUI に組み込まれたツールで、外部画像編集ソフトを使わずに画像上で直接マスクを作成・編集できます。複数の描画ツール、レイヤー管理、元に戻す/やり直し、キャンバス変換、GPU アクセラレーションによるブラシ描画をサポートしています

マスクエディターは現在、`Load Image` ノードを介して起動されます。画像をアップロードした後、ノードを右クリックし、メニューから `Open in MaskEditor` を選択してマスクエディターを開くことができます。
---

## 開き方

マスクエディターを開くには 3 つの方法があります:

1. **選択ツールバー** — Load Image ノードを選択し、ノード上部の選択ツールバーにある Mask アイコンボタンをクリックします。
2. **画像オーバーレイ** — 画像プレビュー(ギャラリーモード)にマウスを乗せ、左上に表示される「Edit or mask image」ボタン(mask アイコン)をクリックします。
3. **右クリックメニュー** — Load Image ノードを右クリックし、メニューから「マスクエディタで開く」を選択します。

> マスクエディターは**グラフモード**と**アプリモード**の両方で使用できます。

![マスクエディターを開く 3 つの方法:Selection Toolbox、Image Overlay、右クリックメニュー](/images/interface/maskeditor/maskeditor_3ways_to_open_maskeditor.png)

---

## インターフェース概要

![マスクエディターのメインインターフェース:ツールパネル、キャンバス、設定パネル](/images/interface/maskeditor/maskeditor_main_editor.jpg)

マスクエディターはモーダルダイアログとして開き、4 つの主要エリアで構成されています:

| # | エリア | 位置 | 説明 |
|---|-------|------|------|
| 1 | **トップバー** | 上部 | 元に戻す/やり直し、キャンバス変換、反転/クリア、保存/キャンセル |
| 2 | **ツールパネル** | 左側 | ツール選択とズーム情報 |
| — | **キャンバスエリア** | 中央 | 描画・編集を行うメインキャンバスエリア |
| 3 | **サイドパネル** | 右側 | ツール固有の設定とレイヤーコントロール |

![ComfyUI マスクエディター](/images/interface/maskeditor/maskeditor.jpg)
---

## ツール

左側のツールパネルには 5 つのツールがあります。ツールを選択すると、右側パネルに対応する設定が表示されます。

<img src="/images/interface/maskeditor/maskeditor_tool_panel.jpg" alt="マスクエディターのツールパネル(5 つのツール番号付き)" style={{maxWidth: '300px'}} />

| # | ツール | レイヤー | 説明 |
|---|-------|---------|------|
| 1 | **Mask Pen** | マスクレイヤー | マスク描画の主要ツール。左クリック+ドラッグで画像上にマスクを描きます。 |
| 2 | **Paint Pen** | ペイントレイヤー(RGB) | 画像の RGB レイヤーに直接描画します。インペイントやベース画像の修正に便利です。 |
| 3 | **Eraser** | マスクレイヤー / ペイントレイヤー | 既存のマスクやペイントレイヤーの一部を消去します。 |
| 4 | **Paint Bucket** | マスクレイヤー | 色の類似性に基づく塗りつぶしツール。ピクセルをクリックすると接続領域にマスクを塗りつぶします。マスク済み領域をクリックするとマスクを消去します。許容値(Tolerance)で塗りつぶしの広がりを制御します。 |
| 5 | **Color Select** | マスクレイヤー | ターゲット色に一致する全ピクセルを選択的にマスクします。高度なマッチングアルゴリズム(Simple / HSL / LAB)に対応。 |

---

## TopBar 操作

![マスクエディター TopBar 操作(1–10 の番号付き)](/images/interface/maskeditor/maskeditor_topbar_actions.jpg)

![ComfyUI マスクエディター](/images/interface/maskeditor/maskeditor_ui.jpg)
上部バーではキャンバス全体に対する操作が行えます:

その後、マウスで画像上をクリックすることで、マスクの作成と編集が行えます。
| # | 操作 | 説明 |
|---|------|------|
| 1 | **元に戻す**(Ctrl+Z) | 最後の操作を元に戻す |
| 2 | **やり直し**(Ctrl+Shift+Z / Ctrl+Y) | 元に戻した操作をやり直す |
| 3 | **左に回転** | 全レイヤーを反時計回りに 90° 回転 |
| 4 | **右に回転** | 全レイヤーを時計回りに 90° 回転 |
| 5 | **左右反転** | 全レイヤーを水平反転 |
| 6 | **上下反転** | 全レイヤーを垂直反転 |
| 7 | **反転** | マスクを反転(黒 ↔ 白) |
| 8 | **クリア** | マスク全体をクリア |
| 9 | **保存** | マスクを保存してエディターを閉じる |
| 10 | **キャンセル** | 保存せずにエディターを閉じる |

> **注**:回転と反転操作は 3 つのレイヤー(マスク、ペイント、ベース画像)すべてに同時に適用されます。変換後に GPU テクスチャが再作成されます。

---

## レイヤー

右側パネル下部の **レイヤー** セクションでは、各レイヤーの表示/非表示を個別に切り替えられます:

- **マスクレイヤー**:マスクオーバーレイ。**マスク不透明度**と**マスク合成オプション**を調整可能:
- `黒` — マスクを黒のオーバーレイとして表示
- `白` — マスクを白のオーバーレイとして表示
- `ネガティブ` — マスクを反転表示
- **ペイントレイヤー**:RGB ペイントレイヤー(Paint Pen 使用時に表示)
- **ベース画像レイヤー**:元のソース画像

レイヤーの **レイヤーを有効化** をクリックすると、そのレイヤーに描画フォーカスが切り替わります。

上のメインエディターのスクリーンショットを参照 — 右側パネルにはブラシ設定と下部のレイヤーセクションが含まれています。

---

## ブラシ設定

ブラシベースのツール(Mask Pen、Paint Pen、Eraser)がアクティブな場合、サイドパネルにブラシ設定が表示されます:

| 設定 | 範囲 | 説明 |
|------|------|------|
| **ブラシ形状** | Arc / Rect | 丸ブラシまたは四角ブラシ |
| **カラーピッカー** | 任意の 16 進色 | ペイント色(Paint Pen 用)またはマスク色 |
| **太さ** | 1–250 | ブラシ直径(ピクセル) |
| **不透明度** | 0–1 | ブラシストロークの透明度 |
| **硬さ** | 0–1 | エッジの柔らかさ。1 = 硬いエッジ、0 = 非常に柔らかい |
| **ステップサイズ** | 1–100 | ブラシの打点間隔。値が低いほど滑らかなストローク |

**デフォルトにリセット** でブラシパラメーターをデフォルトに戻せます。

---

## キャンバス操作とショートカット

| ショートカット | 操作 |
|--------------|------|
| **Space + ドラッグ** | キャンバスのパン |
| **Ctrl + スクロール** | ズームイン/アウト |
| **ズーム%をクリック** | ズームを 100% にリセット |
| **Ctrl + Z** | 元に戻す |
| **Ctrl + Shift + Z** または **Ctrl + Y** | やり直し |
| **Alt + 右クリック + ドラッグ** | ブラシ調整:左右で**サイズ**、上下で**硬さ**を変更 |

---

## 設定

ComfyUI の設定パネルで、以下のマスクエディターオプションを設定できます:

| 設定 | カテゴリー | デフォルト | 説明 |
|------|-----------|-----------|------|
| **Brush adjustment speed multiplier** | Mask Editor → Brush Adjustment → Sensitivity | 1.0 (0.1–2.0) | Alt+右クリックドラッグ時のブラシサイズ・硬さ変更速度。値が大きいほど速い |
| **Lock brush adjustment to dominant axis** | Mask Editor → Brush Adjustment → Use Dominant Axis | オン | 有効にすると、移動の主軸方向に応じてサイズ**または**硬さのみが調整される |

---

## 動画チュートリアル

<video controls>
<source src="/images/interface/maskeditor/maskeditor.mp4" type="video/mp4"/>
お使いのブラウザは video タグをサポートしていません。
</video>
</video>

> **注**:この動画は旧バージョンのマスクエディター(Nodes 1.0 UI)を示しており、ブラシサイズ調整とマスクプレビュー作成の基本フローをデモンストレーションしています。現在のバージョンでも基本的なワークフローは同じです。
Loading
Loading