Compare commits

...
1 Commits
15 changed files with 2093 additions and 19 deletions
+38
View File
@@ -2,6 +2,44 @@
---
## v0.3.71
### Inpaint機能の追加(GenerateUI Imageタブ + Image Edit「Inpaint」タブ)
ユーザー要望「インペイント機能を追加したい」。参考ワークフロー(SDXL + VAEEncodeForInpaint構成)の解析から着手し、複数セッションにわたり段階的に実装。
**対象ファイル:** `static/js/comfyui-workflow.js`, `static/js/comfyui-editor.js`, `static/js/image-edit-tab.js`, `static/js/generate-tab.js`, `static/js/i18n.js`, `static/css/main.css`, `templates/index.html`, `static/js/app.js`
**ワークフロー解析(`analyzeWorkflow`):**
- `load_image_nodes` に `mask_used` フラグを追加。`LoadImage` ノードのMASK出力(output slot 1)が他ノードの入力(`["<id>", 1]` 参照)として使われているかを走査して判定。`MaskEditorNode` 等の中継ノードを経由していても、参照元のLoadImageまで正しく特定できる
- `inpaint_encode_nodes`(`VAEEncodeForInpaint` の `grow_mask_by`)、`mask_editor_one_nodes`(`MaskEditorOne` ノード)を新規検出
**生成UI Input/Imageタブ — マスクスロット:**
- `mask_used` なLoadImageスロットにのみ「Mask」ドロップゾーンを追加表示
- Apply時、マスク指定があれば画像+マスクをRGBA合成(マスク白領域→アルファ0)して1枚のPNGとしてアップロード。ComfyUIネイティブの `mask = 1 - alpha` 抽出にそのまま準拠するため追加ノード不要
- Mask Editor One ノード用の専用スロットも追加(画像・マスクの両方が揃って初めてApply可能)
**Image Editタブ — Inpaintツール(🩹):**
- プロパティパネルにポジ/ネガプロンプト、Grow Mask By、Denoise、Runボタン、結果画像プレビューを追加
- Run押下で: 非マスクレイヤー合成画像 + アクティブなマスクレイヤーを書き出し → 生成UIのインペイント対応スロットへRGBA合成アップロード → プロンプト/grow_mask_by/denoiseを反映 → GenerateUIの生成を呼び出し(画面はImage Editタブに留まる)→ 完了後の結果画像をプロパティパネルに表示
- **バグ修正:** ツールバーの `<button data-tool="inpaint">` を `templates/index.html` に追加し忘れており、`TOOL_DEFS` にエントリを追加しただけではボタンが表示されない不具合があった(ツールバーは静的HTML、`TOOL_DEFS` は `ready` 判定とラベル参照専用)
**Mask Editor One(`comfyui-mask-editor-one`)対応:**
- 実装(`nodes.py`/`server.py`)を調査した結果、この custom node は `LoadImage` を介さず、画像はサーバー側インメモリキャッシュ(`node_id` キー、`bg_image_b64`、`/mask_editor/store_image` でPOST)から、マスクは `layer_data`(JSON文字列ウィジェット)の各レイヤーの**アルファチャンネル**から合成されると判明(`LoadImage` の `1 - alpha` とは逆で、alpha値がそのままmask値になる規約)
- `comfyEditor.applyImageAndMaskToMaskEditorOneNode()` を新規実装し、この2つの経路(画像キャッシュPOST + layer_data書き込み)を実装
- Inpaint Runは `mask_used` なLoadImageスロットを優先し、無ければMask Editor Oneノードへ自動フォールバック
**インペイント専用ワークフロー:**
- Inpaintプロパティ上部に「Use dedicated workflow」チェックボックス + 保存済みワークフロー選択ドロップダウンを追加。OFF時は従来通りGenerateUIの読み込み中ワークフローを使用、ON時は選択したワークフローをその場でロード・解析し、**GenerateUIタブの表示状態には一切触れずに**画像/マスク/プロンプト/パラメータを適用して生成
- `generate-tab.js`: `_coreGenerate`/`handleGenerate` に `workflowOverride` 引数を追加(省略時は従来通り `comfyUI.currentWorkflow` を使用)。オーバーライド時はバッチモードの影響を受けない単発生成に固定し、GenerateUI側のプロンプト同期(`syncToWorkflow`)もスキップ
- `comfyui-editor.js`: `applyImageAndMaskToSlot` / `applyImageAndMaskToMaskEditorOneNode` / `setPromptText` / `setInpaintParams` に `{workflow, analysis}` オプションを追加し、指定時はそちらへ直接書き込む方式に統一
**サンプルワークフロー追加:** `workflows/ws_inpaint_basic.json`(LoadImage直結)、`workflows/ws_inpaint_mask_editor_one.json`(Mask Editor One使用)とプレビュー画像
**ヘルプ更新(3点セット):** `templates/index.html`、`static/js/i18n.js`(EN/JA/ZH `helpImageEdit7e` 新規)、`static/js/app.js`(`helpIdMap` に `wfm-help-imageedit-7e` 追加)
**既知の簡略化点:** Grow Mask By / Denoiseのプロパティパネル初期表示値は、専用ワークフロー使用時も常にGenerateUI側の読み込み中ワークフローから算出される(Run実行時に書き込まれる値自体は専用ワークフロー側に正しく反映される)
## v0.3.70
### Workflow AI要約: Ollama 404エラー修正
+12 -2
View File
@@ -21,7 +21,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- Built-in AI tools (translation and more)
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.3.70-green)
![Version](https://img.shields.io/badge/version-0.3.71-green)
## Screenshots
@@ -85,6 +85,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **Input tab** — Prompt and Image inner tabs (drag-and-drop upload); Prompt tab shows Positive Prompt and Negative Prompt textareas, plus an **Embeddings selector** at the bottom (Filter + Select + Weight input + Paste button); Paste inserts `(embedding:Name:weight)` at the cursor position of the last focused textarea (defaults to Positive when neither is focused); Raw JSON (540px) in the right column
- **Revert button** (v0.3.70) — a ↺ button next to each Apply button reverts the textarea to the node's currently applied value (the reverse of Apply)
- **Emphasis weight editing** (v0.3.70) — select text (or just place the cursor on a word/parenthesis block) and press Ctrl+↑/↓ to adjust `(text:weight)` by ±0.05, A1111/native-ComfyUI style; parentheses are removed automatically when the weight returns to 1.0
- **Mask slot for inpainting** (v0.3.71) — LoadImage slots whose MASK output feeds an inpaint node (e.g. `VAEEncodeForInpaint`) show an additional Mask drop zone; when a mask is set, image + mask are composited into a single RGBA upload (mask baked into the alpha channel) matching ComfyUI's native alpha→MASK extraction — no extra nodes required
- **Model tab** — Checkpoint, VAE, LoRA, ControlNet, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — single clip: type + device; dual clip: two clip selectors + type + device), **Hypernetwork** (with Strength field) selectors with filter; Raw JSON on the right
- **Settings tab** — KSampler and Latent Image side by side at 50% width each; Raw JSON on the right
- **Always-visible Raw JSON** — edit the API-format JSON directly from any tab with syntax highlighting; Apply button reloads the workflow; built-in **search bar** (always shown) finds all matches as you type with count display (`3/12`); navigate with ↑/↓ buttons or Enter / Shift+Enter; Escape or ✕ clears; current match highlighted in orange, other matches in yellow
@@ -250,7 +251,7 @@ Two independent modes selectable via **[Image Loop] / [Gallery]** toggle buttons
- **Layer-based image editor** — compose images with multiple layers (Image, Text, Draw, Mask types) and export the composite as PNG
- **Loading images** — drag & drop onto the canvas, Upload button, or send from the Gallery tab via the **Image Edit** toolbar button; first image becomes Layer 1 (auto-locked), subsequent images are added as new layers scaled to fit the canvas
- **New button** — create a blank canvas with custom dimensions (WxH prompt); clears all existing layers and automatically adds an empty Layer 1 (v0.3.70)
- **Tools** — Select (V), Draw (B), Text (T), Shape (S), Mask (🎭), Blur (≈), BG Remove (⬚), Filter (★); tool options bar updates per active tool
- **Tools** — Select (V), Draw (B), Text (T), Shape (S), Mask (🎭), Blur (≈), BG Remove (⬚), Filter (★), Inpaint (🩹); tool options bar updates per active tool
- **Select** — click to select; drag to move; drag corner handles to resize; drag circle handle to rotate; Flip H / Flip V / Rotate angle in the options bar; double-click a text layer to re-edit its content
- **Draw** — freehand brush; options: color, brush size, blend mode; paints directly onto the active draw layer while all other layers remain visible; brush cursor shown as a size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
- **Text** — click to place; configure font, size, bold/italic, align, and color; placed as an exact-size text layer sized to the measured bounding box; double-click to re-edit
@@ -259,6 +260,7 @@ Two independent modes selectable via **[Image Loop] / [Gallery]** toggle buttons
- **Blur** — **Whole Blur**: Gaussian blur to the entire active layer with intensity slider (1–50 px); **Whole Mosaic**: pixelation mosaic with block-size slider (5–100 px); **Rect Blur / Rect Mosaic**: enable the toggle then drag a rectangle on the canvas to apply blur or mosaic to that region only (blue preview for blur, orange for mosaic); Rect Blur and Rect Mosaic are mutually exclusive; all operations support Undo
- **BG Remove** — remove the background from the active layer; **Lightweight (@imgly)**: runs entirely in the browser via CDN (no server required; ~40 MB model downloaded on first use); **BiRefNet**: high-quality removal via Mask Editor One's Python backend (requires Mask Editor One installed and `birefnet.safetensors` in `ComfyUI/models/background_removal/`); **New Layer** option (default on) adds the result as a new layer above the original; when off, replaces the active layer in-place
- **Filter (G'MIC)** — apply G'MIC-Qt filter effects to the active image layer; click **Edit with G'MIC** to launch G'MIC-Qt GUI; select a filter and click OK — a "G'MIC-Qt filter output" window appears; close it to save the result back as the active layer; requires G'MIC-Qt Standalone installed and path configured in Settings → G'MIC-Qt Executable Path
- **Inpaint** (v0.3.71) — composites the visible layers plus a Mask layer into one RGBA image (mask baked into the alpha channel) and applies it to the first inpaint-capable LoadImage node in the workflow currently loaded in GenerateUI (a node whose MASK output feeds something like `VAEEncodeForInpaint`); also supports workflows built around the **Mask Editor One** custom node (`comfyui-mask-editor-one`) instead of LoadImage — image/mask are pushed via its node_id-keyed server cache and `layer_data` widget; **Properties pane**: Positive/Negative prompts, Grow Mask By (applied to the VAE Encode (for Inpainting) node), Denoise (applied to KSampler), Run button; **Use dedicated workflow** checkbox — when off, generates against the workflow currently loaded in GenerateUI; when on, pick a saved workflow from the dropdown to load, edit, and generate entirely in the background without disturbing what's shown in GenerateUI; the result image is shown back in the Properties pane when generation completes; requires a Mask layer painted first (Mask tool)
- **Layer panel** — layer list with visibility (👁/🚫), lock (🔒/🔓), and clipping-mask (✂) toggles; opacity slider; type icons (🖼 image / T text / ✏ draw / ⬚ mask); Layer 1 is automatically locked on first image load
- **Layer lock** — locked layers show an orange bounding box and 🔒 icon on the canvas; move/resize/rotate are disabled while locked; click the 🔓 button in the layer row to unlock
- **Text quality** — text layers are rendered at their measured bounding-box size; resizing with the Select tool regenerates the canvas at the new display resolution so text stays sharp
@@ -396,6 +398,14 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
## Changelog
### v0.3.71
- **Image Edit — Inpaint tool (🩹)** — new tool composites the canvas (all non-mask layers) plus the active mask layer, uploads to an inpaint-capable LoadImage node (or a Mask Editor One node) in the GenerateUI workflow, applies Positive/Negative prompts, Grow Mask By, and Denoise, then triggers generation — all without leaving the Image Edit tab; the result is shown in the Properties pane
- **Image Edit — Inpaint: dedicated workflow** — "Use dedicated workflow" checkbox lets you pick a saved workflow to run the inpaint against instead of the one currently loaded in GenerateUI, without disturbing what's shown there
- **Image Edit — Inpaint: Mask Editor One support** — workflows built around the `comfyui-mask-editor-one` custom node (no LoadImage) are also supported; image/mask are pushed via its node_id-keyed server cache and `layer_data` widget
- **GenerateUI — Input/Image tab mask slots** — LoadImage nodes whose MASK output feeds an inpaint node (e.g. `VAEEncodeForInpaint`) now show an additional Mask drop zone; image + mask are composited into a single RGBA upload matching ComfyUI's native alpha→MASK extraction
- New example workflows: `ws_inpaint_basic.json`, `ws_inpaint_mask_editor_one.json`
### v0.3.70
- **Workflow AI summary — Ollama 404 fix** — the summarize button in the workflow detail modal now uses the Ollama URL/model saved in Settings → AI Assistant Settings (previously it silently fell back to a hardcoded default model tag that didn't match locally installed models, causing a 404)
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-workflow-studio"
description = "A comprehensive workflow, asset management, and generation UI plugin for ComfyUI. Manage workflows, models, images, and prompts; batch generation and Image Feeder in the GenerateUI tab; library side panel with canvas drag & drop and AI tools."
version = "0.3.70"
version = "0.3.71"
license = "MIT"
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+35
View File
@@ -2938,6 +2938,41 @@ body {
line-height: 24px;
}
.wfm-i2i-mask-section {
margin-top: 8px;
padding-top: 8px;
border-top: 1px dashed var(--wfm-border);
}
.wfm-i2i-mask-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
font-size: 11px;
font-weight: 600;
color: var(--wfm-text-secondary);
margin-bottom: 6px;
}
.wfm-i2i-mask-filename {
font-size: 10px;
font-weight: 400;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 120px;
}
.wfm-i2i-mask-preview-wrap .wfm-i2i-preview-img {
max-height: 70px;
background: #000;
}
.wfm-i2i-mask-drop-zone {
padding: 8px;
}
/* ============================================
Side Panel - Thumbnail Tab
============================================ */
+1 -1
View File
@@ -445,7 +445,7 @@ function applyI18nToHtml() {
"wfm-help-imageedit-28": "helpImageEdit28", "wfm-help-imageedit-29": "helpImageEdit29",
"wfm-help-imageedit-30": "helpImageEdit30",
"wfm-help-imageedit-7b": "helpImageEdit7b", "wfm-help-imageedit-7c": "helpImageEdit7c",
"wfm-help-imageedit-7d": "helpImageEdit7d",
"wfm-help-imageedit-7d": "helpImageEdit7d", "wfm-help-imageedit-7e": "helpImageEdit7e",
"wfm-help-imageedit-8b": "helpImageEdit8b",
"wfm-help-imageedit-blur-title": "helpImageEditBlurTitle",
"wfm-help-imageedit-blur-1": "helpImageEditBlur1", "wfm-help-imageedit-blur-2": "helpImageEditBlur2",
+368 -4
View File
@@ -154,6 +154,87 @@ function _syncRawJson() {
}
}
// ── Inpaint: 画像+マスクのRGBA合成 ──────────────────────
// mask は白=インペイント対象領域/黒=維持領域のグレースケール画像を想定(Image Editの
// マスクレイヤーも、手動でドロップする白黒マスクファイルも同じ規約)。
// ComfyUIネイティブのLoadImageはアルファチャンネルから mask = 1 - alpha を抽出するため、
// 合成後の alpha は 255 - maskGray とする。
async function _loadImageElement(src) {
const isBlobLike = src instanceof Blob;
const url = isBlobLike ? URL.createObjectURL(src) : src;
try {
const img = new Image();
img.src = url;
await new Promise((resolve, reject) => {
img.onload = resolve;
img.onerror = () => reject(new Error("Failed to load image"));
});
return img;
} finally {
if (isBlobLike) URL.revokeObjectURL(url);
}
}
async function _compositeImageWithMask(imageInput, maskInput) {
const img = await _loadImageElement(imageInput);
const mask = await _loadImageElement(maskInput);
const w = img.naturalWidth, h = img.naturalHeight;
const canvas = document.createElement("canvas");
canvas.width = w; canvas.height = h;
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, w, h);
const imgData = ctx.getImageData(0, 0, w, h);
const maskCanvas = document.createElement("canvas");
maskCanvas.width = w; maskCanvas.height = h;
const mctx = maskCanvas.getContext("2d");
mctx.drawImage(mask, 0, 0, w, h);
const maskData = mctx.getImageData(0, 0, w, h).data;
const data = imgData.data;
for (let i = 0; i < data.length; i += 4) {
data[i + 3] = 255 - maskData[i];
}
ctx.putImageData(imgData, 0, 0);
return new Promise((resolve) => canvas.toBlob(resolve, "image/png"));
}
// ── Inpaint: Mask Editor One (comfyui-mask-editor-one) ノード向けヘルパー ──────
// この custom node は LoadImage を介さず、画像は /mask_editor/store_image でサーバー側
// キャッシュ(bg_image_b64, node_idキー)へ、マスクは layer_data(JSON文字列)ウィジェットの
// 各レイヤーの「アルファチャンネル」から合成される(LoadImageの 1-alpha とは逆で、
// alpha値がそのままmask値になる規約)。
async function _imageInputToDataURL(imageInput) {
const img = await _loadImageElement(imageInput);
const canvas = document.createElement("canvas");
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
canvas.getContext("2d").drawImage(img, 0, 0);
return canvas.toDataURL("image/png");
}
async function _maskInputToAlphaDataURL(maskInput) {
const img = await _loadImageElement(maskInput);
const w = img.naturalWidth, h = img.naturalHeight;
const canvas = document.createElement("canvas");
canvas.width = w; canvas.height = h;
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, w, h);
const imgData = ctx.getImageData(0, 0, w, h);
const data = imgData.data;
for (let i = 0; i < data.length; i += 4) {
const gray = data[i];
data[i] = data[i + 1] = data[i + 2] = 255;
data[i + 3] = gray;
}
ctx.putImageData(imgData, 0, 0);
return canvas.toDataURL("image/png");
}
// ── プロンプト強調weight編集 (Ctrl+↑/↓) ──────────────────────
// A1111 / ComfyUIネイティブのCLIP Text Encodeと同様の操作感:
// 選択(無ければカーソル位置の括弧ブロックまたは単語)を (text:weight) 形式に変換し、
@@ -1114,14 +1195,18 @@ export const comfyEditor = {
if (!el) return;
const loadNodes = analysis.load_image_nodes || [];
if (loadNodes.length === 0) {
el.innerHTML = `<p class="wfm-placeholder">No LoadImage nodes found in workflow</p>`;
const meoNodes = analysis.mask_editor_one_nodes || [];
if (loadNodes.length === 0 && meoNodes.length === 0) {
el.innerHTML = `<p class="wfm-placeholder">No LoadImage / Mask Editor One nodes found in workflow</p>`;
return;
}
// Render up to 4 image input slots
const slots = loadNodes.slice(0, 4);
// Mask Editor One ノード(画像+マスクを内包、常に両方必須)— 別枠で最大2件表示
const meoSlots = meoNodes.slice(0, 2);
el.innerHTML = `
${slots.length === 0 ? "" : `
<div class="wfm-i2i-grid">
${slots.map((node, i) => `
<div class="wfm-i2i-slot" data-slot="${i}" data-node-id="${node.id}">
@@ -1138,6 +1223,23 @@ export const comfyEditor = {
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-i2i-file-${i}" style="display:none;">
</label>
</div>
${node.mask_used ? `
<div class="wfm-i2i-mask-section">
<div class="wfm-i2i-mask-header">
<span>Mask</span>
<span class="wfm-i2i-mask-filename" id="wfm-i2i-mask-filename-${i}"></span>
</div>
<div class="wfm-i2i-preview-wrap wfm-i2i-mask-preview-wrap" id="wfm-i2i-mask-preview-wrap-${i}" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-i2i-mask-preview-${i}">
</div>
<div class="wfm-i2i-drop-zone wfm-i2i-mask-drop-zone" id="wfm-i2i-mask-drop-${i}">
<label class="wfm-i2i-drop-label">
Drop mask (white=inpaint) or click to select
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-i2i-mask-file-${i}" style="display:none;">
</label>
</div>
</div>
` : ""}
<div style="display:flex;gap:6px;margin-top:6px;">
<button class="wfm-btn wfm-btn-sm wfm-btn-primary wfm-i2i-apply" data-slot="${i}" disabled>Apply</button>
<span class="wfm-i2i-status" id="wfm-i2i-status-${i}"></span>
@@ -1145,6 +1247,46 @@ export const comfyEditor = {
</div>
`).join("")}
</div>
`}
${meoSlots.length === 0 ? "" : `
<div class="wfm-i2i-grid" style="margin-top:12px;">
${meoSlots.map((node, i) => `
<div class="wfm-i2i-slot" data-meo-slot="${i}" data-node-id="${node.id}">
<div class="wfm-i2i-slot-header">
<span style="font-weight:600;font-size:12px;">ID:${node.id} ${node.title} (Mask Editor One)</span>
</div>
<div class="wfm-i2i-preview-wrap" id="wfm-meo-preview-wrap-${i}" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-meo-preview-${i}">
</div>
<div class="wfm-i2i-drop-zone" id="wfm-meo-drop-${i}">
<label class="wfm-i2i-drop-label">
Drop image or click to select
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-meo-file-${i}" style="display:none;">
</label>
</div>
<div class="wfm-i2i-mask-section">
<div class="wfm-i2i-mask-header">
<span>Mask</span>
<span class="wfm-i2i-mask-filename" id="wfm-meo-mask-filename-${i}"></span>
</div>
<div class="wfm-i2i-preview-wrap wfm-i2i-mask-preview-wrap" id="wfm-meo-mask-preview-wrap-${i}" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-meo-mask-preview-${i}">
</div>
<div class="wfm-i2i-drop-zone wfm-i2i-mask-drop-zone" id="wfm-meo-mask-drop-${i}">
<label class="wfm-i2i-drop-label">
Drop mask (white=inpaint) or click to select
<input type="file" accept="image/*" class="wfm-i2i-file" id="wfm-meo-mask-file-${i}" style="display:none;">
</label>
</div>
</div>
<div style="display:flex;gap:6px;margin-top:6px;">
<button class="wfm-btn wfm-btn-sm wfm-btn-primary wfm-meo-apply" data-slot="${i}" disabled>Apply</button>
<span class="wfm-i2i-status" id="wfm-meo-status-${i}"></span>
</div>
</div>
`).join("")}
</div>
`}
`;
// Initialize each slot
@@ -1156,7 +1298,13 @@ export const comfyEditor = {
const filenameEl = document.getElementById(`wfm-i2i-filename-${i}`);
const statusEl = document.getElementById(`wfm-i2i-status-${i}`);
const dropZone = document.getElementById(`wfm-i2i-drop-${i}`);
const maskFileInput = document.getElementById(`wfm-i2i-mask-file-${i}`);
const maskDropZone = document.getElementById(`wfm-i2i-mask-drop-${i}`);
const maskPreviewWrap = document.getElementById(`wfm-i2i-mask-preview-wrap-${i}`);
const maskPreviewImg = document.getElementById(`wfm-i2i-mask-preview-${i}`);
const maskFilenameEl = document.getElementById(`wfm-i2i-mask-filename-${i}`);
let pendingFile = null;
let pendingMaskFile = null;
const applyFile = (file) => {
if (!file || !file.type.startsWith("image/")) return;
@@ -1169,10 +1317,24 @@ export const comfyEditor = {
statusEl.textContent = "";
};
const applyMaskFile = (file) => {
if (!file || !file.type.startsWith("image/")) return;
pendingMaskFile = file;
const url = URL.createObjectURL(file);
maskPreviewImg.src = url;
maskPreviewWrap.style.display = "";
maskFilenameEl.textContent = file.name;
applyBtn.disabled = false;
statusEl.textContent = "";
};
// File input change
fileInput?.addEventListener("change", () => {
if (fileInput.files.length > 0) applyFile(fileInput.files[0]);
});
maskFileInput?.addEventListener("change", () => {
if (maskFileInput.files.length > 0) applyMaskFile(maskFileInput.files[0]);
});
// Drag & drop
if (dropZone) {
@@ -1189,14 +1351,39 @@ export const comfyEditor = {
if (e.dataTransfer.files.length > 0) applyFile(e.dataTransfer.files[0]);
});
}
if (maskDropZone) {
maskDropZone.addEventListener("dragover", (e) => {
e.preventDefault();
maskDropZone.classList.add("drag-over");
});
maskDropZone.addEventListener("dragleave", () => {
maskDropZone.classList.remove("drag-over");
});
maskDropZone.addEventListener("drop", (e) => {
e.preventDefault();
maskDropZone.classList.remove("drag-over");
if (e.dataTransfer.files.length > 0) applyMaskFile(e.dataTransfer.files[0]);
});
}
// Apply button: upload to ComfyUI and set on node
// (マスクが指定されている場合は画像+マスクをRGBA合成して1枚のPNGとしてアップロードする)
applyBtn?.addEventListener("click", async () => {
if (!pendingFile) return;
if (!pendingFile && !pendingMaskFile) return;
applyBtn.disabled = true;
statusEl.textContent = "Uploading...";
try {
const result = await comfyUI.uploadImage(pendingFile, pendingFile.name);
let result;
if (pendingMaskFile) {
const baseImage = pendingFile || previewImg.src;
if (!baseImage) throw new Error("No base image to apply mask to");
const composedBlob = await _compositeImageWithMask(baseImage, pendingMaskFile);
const fileName = (pendingFile?.name || node.image || "inpaint.png").replace(/\.[^.]+$/, "") + "_masked.png";
const composedFile = new File([composedBlob], fileName, { type: "image/png" });
result = await comfyUI.uploadImage(composedFile, fileName);
} else {
result = await comfyUI.uploadImage(pendingFile, pendingFile.name);
}
if (result.name) {
// Update workflow node
if (comfyUI.currentWorkflow?.[node.id]) {
@@ -1216,6 +1403,76 @@ export const comfyEditor = {
}
});
});
// Initialize each Mask Editor One slot(画像+マスク両方が揃って初めてApply可能)
meoSlots.forEach((node, i) => {
const fileInput = document.getElementById(`wfm-meo-file-${i}`);
const maskFileInput = document.getElementById(`wfm-meo-mask-file-${i}`);
const dropZone = document.getElementById(`wfm-meo-drop-${i}`);
const maskDropZone = document.getElementById(`wfm-meo-mask-drop-${i}`);
const previewWrap = document.getElementById(`wfm-meo-preview-wrap-${i}`);
const previewImg = document.getElementById(`wfm-meo-preview-${i}`);
const maskPreviewWrap = document.getElementById(`wfm-meo-mask-preview-wrap-${i}`);
const maskPreviewImg = document.getElementById(`wfm-meo-mask-preview-${i}`);
const maskFilenameEl = document.getElementById(`wfm-meo-mask-filename-${i}`);
const applyBtn = el.querySelector(`.wfm-meo-apply[data-slot="${i}"]`);
const statusEl = document.getElementById(`wfm-meo-status-${i}`);
let pendingFile = null;
let pendingMaskFile = null;
const updateApplyEnabled = () => { applyBtn.disabled = !(pendingFile && pendingMaskFile); };
const applyFile = (file) => {
if (!file || !file.type.startsWith("image/")) return;
pendingFile = file;
previewImg.src = URL.createObjectURL(file);
previewWrap.style.display = "";
statusEl.textContent = "";
updateApplyEnabled();
};
const applyMaskFile = (file) => {
if (!file || !file.type.startsWith("image/")) return;
pendingMaskFile = file;
maskPreviewImg.src = URL.createObjectURL(file);
maskPreviewWrap.style.display = "";
maskFilenameEl.textContent = file.name;
statusEl.textContent = "";
updateApplyEnabled();
};
fileInput?.addEventListener("change", () => {
if (fileInput.files.length > 0) applyFile(fileInput.files[0]);
});
maskFileInput?.addEventListener("change", () => {
if (maskFileInput.files.length > 0) applyMaskFile(maskFileInput.files[0]);
});
[[dropZone, applyFile], [maskDropZone, applyMaskFile]].forEach(([zone, handler]) => {
if (!zone) return;
zone.addEventListener("dragover", (e) => { e.preventDefault(); zone.classList.add("drag-over"); });
zone.addEventListener("dragleave", () => zone.classList.remove("drag-over"));
zone.addEventListener("drop", (e) => {
e.preventDefault();
zone.classList.remove("drag-over");
if (e.dataTransfer.files.length > 0) handler(e.dataTransfer.files[0]);
});
});
applyBtn?.addEventListener("click", async () => {
if (!pendingFile || !pendingMaskFile) return;
applyBtn.disabled = true;
statusEl.textContent = "Uploading...";
try {
await this.applyImageAndMaskToMaskEditorOneNode(pendingFile, pendingMaskFile, node.id);
statusEl.textContent = "✓ Applied";
statusEl.style.color = "var(--wfm-success)";
} catch (err) {
statusEl.textContent = `✗ ${err.message}`;
statusEl.style.color = "var(--wfm-danger)";
applyBtn.disabled = false;
}
});
});
},
async applyImageToSlot(file, slotIndex = 0) {
@@ -1248,6 +1505,113 @@ export const comfyEditor = {
return result.name;
},
// imageInput/maskInput: File/Blob いずれも可。マスクは白=インペイント対象領域のグレースケール想定。
// 画像とマスクをRGBA合成し、1枚のPNGとして対象LoadImageノードへアップロードする
// (ComfyUIネイティブのアルファ→MASK抽出に準拠。Image Edit「Inpaint」タブのRunボタンから利用)。
// opts.workflow/opts.analysis を渡すと、comfyUI.currentWorkflow/currentAnalysis の代わりに
// そのワークフローへ書き込む(GenerateUIタブの表示・DOM更新は行わない。専用ワークフロー実行用)。
async applyImageAndMaskToSlot(imageInput, maskInput, slotIndex = 0, opts = {}) {
const workflow = opts.workflow || comfyUI.currentWorkflow;
const analysis = opts.analysis || comfyUI.currentAnalysis;
const loadNodes = analysis?.load_image_nodes || [];
const node = loadNodes[slotIndex];
if (!node) throw new Error("No LoadImage node at slot " + slotIndex);
const composedBlob = await _compositeImageWithMask(imageInput, maskInput);
const fileName = `inpaint_${Math.random().toString(36).slice(2, 10)}.png`;
const composedFile = new File([composedBlob], fileName, { type: "image/png" });
const result = await comfyUI.uploadImage(composedFile, fileName);
if (!result.name) throw new Error("Upload returned no filename");
if (workflow?.[node.id]) {
workflow[node.id].inputs.image = result.name;
}
if (opts.workflow) return result.name;
const previewWrap = document.getElementById(`wfm-i2i-preview-wrap-${slotIndex}`);
const previewImg = document.getElementById(`wfm-i2i-preview-${slotIndex}`);
const filenameEl = document.getElementById(`wfm-i2i-filename-${slotIndex}`);
const statusEl = document.getElementById(`wfm-i2i-status-${slotIndex}`);
const applyBtn = document.querySelector(`.wfm-i2i-apply[data-slot="${slotIndex}"]`);
if (previewImg) {
previewImg.src = `/view?filename=${encodeURIComponent(result.name)}&type=input`;
if (previewWrap) previewWrap.style.display = "";
}
if (filenameEl) filenameEl.textContent = result.name;
if (statusEl) { statusEl.textContent = `✓ ${result.name}`; statusEl.style.color = "var(--wfm-success)"; }
if (applyBtn) applyBtn.disabled = true;
_syncRawJson();
return result.name;
},
// imageInput/maskInput: File/Blob いずれも可。マスクは白=インペイント対象領域のグレースケール想定。
// Mask Editor One (comfyui-mask-editor-one) ノード向け。画像はサーバー側キャッシュへ
// /mask_editor/store_image でPOSHし(node_idキー、bg_image_b64)、マスクは layer_data
// ウィジェットへ「アルファチャンネル=mask値」のレイヤーとして書き込む。
// opts.workflow を渡すと comfyUI.currentWorkflow の代わりにそのワークフローへ書き込む。
async applyImageAndMaskToMaskEditorOneNode(imageInput, maskInput, nodeId, opts = {}) {
const workflow = opts.workflow || comfyUI.currentWorkflow;
const bgDataUrl = await _imageInputToDataURL(imageInput);
const maskDataUrl = await _maskInputToAlphaDataURL(maskInput);
const resp = await fetch(`${comfyUI.baseUrl}/mask_editor/store_image`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ node_id: String(nodeId), bg_image_b64: bgDataUrl }),
});
if (!resp.ok) throw new Error(`Failed to store image for Mask Editor One (node ${nodeId})`);
if (workflow?.[nodeId]) {
workflow[nodeId].inputs.layer_data = JSON.stringify({
layers: [{ visible: true, opacity: 1, operation: "add", imageData: maskDataUrl }],
});
}
if (!opts.workflow) _syncRawJson();
},
// Inpaint Run から呼ばれるポジ/ネガプロンプト設定。
// opts.workflow/opts.analysis を渡すと、GenerateUIタブの選択中ターゲット(DOM)に依存せず、
// そのワークフロー内の最初の該当role prompt_nodeへ直接反映する(専用ワークフロー実行用)。
setPromptText(role, text, opts = {}) {
if (opts.workflow && opts.analysis) {
const node = (opts.analysis.prompt_nodes || []).find((n) => n.role === role);
if (node && opts.workflow[node.id]) {
opts.workflow[node.id].inputs[node.textKey || "text"] = text;
}
return;
}
const textareaId = role === "positive" ? "wfm-prompt-pos-text" : "wfm-prompt-neg-text";
const textarea = document.getElementById(textareaId);
if (textarea) textarea.value = text;
this.syncToWorkflow();
_syncRawJson();
},
// Inpaint Run から呼ばれる grow_mask_by / denoise 設定。
// ワークフロー内の最初の VAEEncodeForInpaint ノード / denoise を持つ最初の sampler ノードへ反映する
// (複数のインペイントパイプラインが同一ワークフローに存在するケースは現状非対応)。
// workflow/analysis を渡すと comfyUI.currentWorkflow/currentAnalysis の代わりにそちらへ書き込む。
setInpaintParams({ growMaskBy, denoise, workflow, analysis } = {}) {
const wf = workflow || comfyUI.currentWorkflow;
const an = analysis || comfyUI.currentAnalysis;
const encodeNode = an?.inpaint_encode_nodes?.[0];
if (encodeNode && growMaskBy != null && wf?.[encodeNode.id]) {
wf[encodeNode.id].inputs.grow_mask_by = growMaskBy;
}
const samplerNode = (an?.sampler_nodes || []).find((n) => n.denoise !== undefined);
if (samplerNode && denoise != null && wf?.[samplerNode.id]) {
wf[samplerNode.id].inputs.denoise = denoise;
}
if (!workflow) _syncRawJson();
},
syncToWorkflow() {
// Sync prompt texts before generation
const posSelect = document.getElementById("wfm-prompt-pos-target");
+36
View File
@@ -487,6 +487,8 @@ export const comfyWorkflow = {
vae_nodes: [],
save_nodes: [],
load_image_nodes: [],
inpaint_encode_nodes: [],
mask_editor_one_nodes: [],
text_encoder_nodes: [],
diffusion_model_nodes: [],
controlnet_nodes: [],
@@ -809,6 +811,22 @@ export const comfyWorkflow = {
});
}
// --- VAE Encode (for Inpainting) nodes ---
if (ct === "VAEEncodeForInpaint") {
result.inpaint_encode_nodes.push({
id, type: ct, title,
grow_mask_by: inputs.grow_mask_by,
});
}
// --- Mask Editor One nodes (comfyui-mask-editor-one) ---
// 画像とマスクをノード自身が内包する(LoadImageを介さない)インペイント画像ソース。
// image出力はサーバー側キャッシュ(bg_image_b64、node_idキー)から、mask出力は
// layer_data(JSON文字列)ウィジェットの各レイヤーのアルファチャンネルから合成される。
if (ct === "MaskEditorOne") {
result.mask_editor_one_nodes.push({ id, type: ct, title });
}
// --- Text encoder (CLIP) nodes ---
if (ct === "DualCLIPLoader" || ct === "CLIPLoader" || ct === "ClipLoaderGGUF" || ct === "DualClipLoaderGGUF") {
result.text_encoder_nodes.push({
@@ -850,6 +868,24 @@ export const comfyWorkflow = {
}
}
// --- Post-pass: flag LoadImage nodes whose MASK output (slot 1) is wired to something
// downstream (directly, or via a pass-through node like MaskEditorNode). These are the
// "inpaint-capable" slots — image + mask both come from the same node's two outputs, so
// painting a mask for them only requires re-uploading that one node's image with the mask
// baked into the alpha channel (matches ComfyUI's native LoadImage alpha→MASK extraction). ---
const loadImageIds = new Set(result.load_image_nodes.filter(n => n.type === "LoadImage").map(n => n.id));
if (loadImageIds.size > 0) {
for (const node of Object.values(workflow)) {
if (!node?.inputs) continue;
for (const v of Object.values(node.inputs)) {
if (Array.isArray(v) && v.length === 2 && Number(v[1]) === 1 && loadImageIds.has(String(v[0]))) {
const target = result.load_image_nodes.find(n => n.id === String(v[0]));
if (target) target.mask_used = true;
}
}
}
}
result.all_nodes.sort((a, b) => Number(a.id) - Number(b.id));
return result;
},
+23 -9
View File
@@ -1397,7 +1397,7 @@ async function _expandWildcardsInWorkflow(workflow) {
// Generation (core — throws on error)
// ============================================
async function _coreGenerate(silent = false) {
async function _coreGenerate(silent = false, workflowOverride = null) {
const progressBar = document.getElementById("wfm-gen-progress-bar");
const progressText = document.getElementById("wfm-gen-progress-text");
const resultImg = document.getElementById("wfm-gen-result-img");
@@ -1409,7 +1409,8 @@ async function _coreGenerate(silent = false) {
if (progressBar) progressBar.style.width = "0%";
if (progressText) progressText.textContent = "Starting...";
const workflowExpanded = await _expandWildcardsInWorkflow({ ...comfyUI.currentWorkflow });
const baseWorkflow = workflowOverride || comfyUI.currentWorkflow;
const workflowExpanded = await _expandWildcardsInWorkflow({ ...baseWorkflow });
const workflowForGenerate = _applyStyleToWorkflow(workflowExpanded);
const { images, seed } = await comfyUI.generate(
workflowForGenerate,
@@ -1463,7 +1464,7 @@ async function _coreGenerate(silent = false) {
}
if (images.length > 0) {
saveGeneratedImagesMeta(images, { ...comfyUI.currentWorkflow }).catch(() => {});
saveGeneratedImagesMeta(images, { ...baseWorkflow }).catch(() => {});
}
if (!silent) showToast(t("generationComplete"), "success");
@@ -1729,14 +1730,20 @@ async function _runBatchGenerate() {
// Generate entry point
// ============================================
async function handleGenerate() {
if (!comfyUI.currentWorkflow) {
// workflowOverride: 明示的に渡された場合、comfyUI.currentWorkflow の代わりにこのワークフローで
// 生成する(GenerateUIの表示状態には触れない。Image Edit「Inpaint」の専用ワークフロー実行から利用)。
// ボタンのclickハンドラから呼ばれる場合は第一引数がMouseEventになるため、その場合は無視する。
async function handleGenerate(workflowOverride = null) {
if (workflowOverride instanceof Event) workflowOverride = null;
if (!workflowOverride && !comfyUI.currentWorkflow) {
showToast(t("noWorkflowLoaded"), "error");
return;
}
if (comfyUI.generating) return;
comfyEditor.syncToWorkflow();
// オーバーライド実行時は GenerateUI 側の表示中プロンプトを別ワークフローへ誤って書き込まないよう同期をスキップする
if (!workflowOverride) comfyEditor.syncToWorkflow();
const genBtn = document.getElementById("wfm-gen-generate-btn");
const interruptBtn = document.getElementById("wfm-gen-interrupt-btn");
@@ -1747,18 +1754,20 @@ async function handleGenerate() {
_ckptBatch.paused = false;
_ckptBatch._resumeResolve = null;
const batchEnabled = _activeBatchType !== null;
// オーバーライド実行時はバッチモードの影響を受けない単発生成に固定する
const batchEnabled = !workflowOverride && _activeBatchType !== null;
try {
if (batchEnabled) {
await _runBatchGenerate();
} else {
try {
await _coreGenerate(false);
await _coreGenerate(false, workflowOverride);
} catch (err) {
const progressText = document.getElementById("wfm-gen-progress-text");
if (progressText) progressText.textContent = "Error";
showToast(t("generationError", err.message), "error");
throw err;
}
}
} finally {
@@ -1819,7 +1828,12 @@ export async function initGenerateTab() {
});
// Generate button
document.getElementById("wfm-gen-generate-btn")?.addEventListener("click", handleGenerate);
document.getElementById("wfm-gen-generate-btn")?.addEventListener("click", () => {
handleGenerate().catch(() => {});
});
// Cross-tab entry point (Image Edit「Inpaint」タブの Run ボタンなど外部から生成を呼び出す用)
window._wfmGenerateTab = { generate: handleGenerate };
// Alt+Apply from Input/Model/Settings tabs → Apply & Generate
document.addEventListener("wfm:apply-and-generate", () => handleGenerate());
+3
View File
@@ -794,6 +794,7 @@ const LANGUAGES = {
helpImageEdit7b: "Blur (≈): apply Gaussian blur or mosaic to the active layer — whole-layer or region-based (drag a rectangle); see the Blur Tool card below for details",
helpImageEdit7c: "BG Remove (⬚): remove the background from the active layer using Lightweight (@imgly, runs in browser) or BiRefNet (requires Mask Editor One + birefnet.safetensors in ComfyUI/models/background_removal/); see the BG Remove Tool card below for details",
helpImageEdit7d: "Mask (🎭): paint masks on a mask layer using 6 sub-tools — Paint (freehand), Color (flood-select by similar color), Alpha (extract from image transparency), Text (stamp text), Vector (Catmull-Rom spline polygon), Shape (rect / ellipse); SAM3 text-prompt segmentation is also available when Mask Editor One is installed; click \"M\" in the Layers header to add a mask layer; see the Mask Tool card below for details",
helpImageEdit7e: "Inpaint (🩹): composites the visible layers plus a Mask layer into one RGBA image (mask baked into the alpha channel) and applies it to the first inpaint-capable LoadImage node in the workflow currently loaded in GenerateUI (a node whose MASK output feeds something like VAEEncodeForInpaint); enter Positive/Negative prompts, Grow Mask By (applied to the VAE Encode (for Inpainting) node), and Denoise (applied to KSampler) in the properties panel, then click Run to upload and generate without leaving the Image Edit tab — the result is shown back in the properties panel when done; requires a Mask layer to be painted first and an inpaint-capable workflow loaded in GenerateUI; also works with workflows built around the Mask Editor One custom node (comfyui-mask-editor-one) instead of LoadImage — image/mask are pushed to it via its node_id-keyed server cache and layer_data widget; \"Use dedicated workflow\" checkbox: when off, the workflow currently loaded in GenerateUI is used (unchanged); when on, pick a saved workflow from the dropdown — it is loaded, edited, and generated entirely in the background without disturbing the workflow shown in GenerateUI",
helpImageEdit8b: "\"M\" button in the Layers header: adds a new mask layer above the current layer and automatically switches to the Mask tool",
helpImageEdit12: "Type icons: 🖼 = image layer, T = text layer, ✏ = draw layer, ⬚ = mask layer",
helpImageEditMaskTitle: "Mask Tool (🎭)",
@@ -1777,6 +1778,7 @@ const LANGUAGES = {
helpImageEdit7b: "Blur (≈):アクティブレイヤーにガウスぼかしまたはモザイクを適用 — 全体またはドラッグで矩形範囲指定;詳細は下の「Blur Tool」カードを参照",
helpImageEdit7c: "BG Remove (⬚):Lightweight(@imgly、ブラウザ内処理)またはBiRefNet(Mask Editor One + ComfyUI/models/background_removal/にbirefnet.safetensors必須)でアクティブレイヤーの背景を除去;詳細は下の「BG Remove Tool」カードを参照",
helpImageEdit7d: "Mask (🎭):6つのサブツールでマスクレイヤーにマスクを描画 — Paint(フリーハンド)・Color(色類似度フラッドセレクト)・Alpha(画像の透過チャンネル抽出)・Text(テキストスタンプ)・Vector(Catmull-Romスプライン多角形)・Shape(矩形/楕円);Mask Editor OneインストールでSAM3テキストプロンプトセグメンテーションも利用可能;レイヤーヘッダーの「M」でマスクレイヤーを追加;詳細は下の「Mask Tool」カードを参照",
helpImageEdit7e: "Inpaint (🩹):表示中のレイヤーとマスクレイヤーを1枚のRGBA画像に合成(マスクをアルファチャンネルに焼き込み)し、GenerateUIで読み込み中のワークフロー内でインペイント対応の最初のLoadImageノード(MASK出力がVAEEncodeForInpaint等に接続されているノード)へ適用;プロパティパネルでポジ/ネガプロンプト、Grow Mask By(VAE Encode (for Inpainting)ノードへ反映)、Denoise(KSamplerへ反映)を入力してRunを押すと、Image Editタブに留まったままアップロード・生成を実行;完了後は結果画像がプロパティパネルに表示される;事前にマスクレイヤーの描画とインペイント対応ワークフローの読み込みが必要;LoadImageの代わりにMask Editor Oneカスタムノード(comfyui-mask-editor-one)を使ったワークフローにも対応(node_idキーのサーバーキャッシュとlayer_dataウィジェット経由で画像/マスクを反映);「Use dedicated workflow」チェックボックス:OFF時はGenerateUIで読み込み中のワークフローを使用(従来通り)、ON時はドロップダウンから保存済みワークフローを選択すると、GenerateUIの表示状態には触れずバックグラウンドで読み込み・編集・生成を実行",
helpImageEdit8b: "レイヤーヘッダーの「M」ボタン:アクティブレイヤーの上に新しいマスクレイヤーを追加し、自動的にMaskツールに切り替える",
helpImageEditMaskTitle: "Mask ツール (🎭)",
helpImageEditMask1: "マスクレイヤーの追加:レイヤーパネルヘッダーの「M」ボタンをクリック;新しいマスクレイヤーはアクティブレイヤーの上に挿入され、Maskツールが自動的に有効化される",
@@ -2759,6 +2761,7 @@ const LANGUAGES = {
helpImageEdit7b: "Blur (≈):对活动图层应用高斯模糊或马赛克 — 整层或拖动矩形区域;详细内容参见下方「Blur Tool」卡片",
helpImageEdit7c: "BG Remove (⬚):使用Lightweight(@imgly,在浏览器中运行)或BiRefNet(需要Mask Editor One + ComfyUI/models/background_removal/中的birefnet.safetensors)去除活动图层背景;详细内容参见下方「BG Remove Tool」卡片",
helpImageEdit7d: "Mask (🎭):使用6种子工具在遮罩图层上绘制遮罩 — Paint(徒手绘制)、Color(按颜色相似度泛选)、Alpha(从图像透明度提取)、Text(文字图章)、Vector(Catmull-Rom样条多边形)、Shape(矩形/椭圆);安装Mask Editor One后还可使用SAM3文本提示分割;点击图层标题栏的「M」添加遮罩图层;详细内容参见下方「Mask Tool」卡片",
helpImageEdit7e: "Inpaint (🩹):将可见图层与遮罩图层合成为一张RGBA图像(遮罩烘焙进alpha通道),并应用到GenerateUI当前加载的工作流中第一个支持内绘的LoadImage节点(其MASK输出连接到VAEEncodeForInpaint等节点);在属性面板中输入正/负向提示词、Grow Mask By(应用到VAE Encode (for Inpainting)节点)、Denoise(应用到KSampler)后点击Run,即可在不离开Image Edit标签的情况下完成上传与生成;完成后结果图像会显示在属性面板中;需先绘制遮罩图层并在GenerateUI中加载支持内绘的工作流;同样支持基于Mask Editor One自定义节点(comfyui-mask-editor-one)而非LoadImage构建的工作流(通过其按node_id缓存的服务端图像与layer_data组件写入图像/遮罩);「Use dedicated workflow」复选框:关闭时使用GenerateUI当前加载的工作流(与之前相同);开启时可从下拉列表选择已保存的工作流,将在后台加载、编辑并生成,不影响GenerateUI中显示的工作流",
helpImageEdit8b: "图层标题栏的「M」按钮:在当前活动图层上方添加新的遮罩图层,并自动切换至Mask工具",
helpImageEditMaskTitle: "Mask 工具 (🎭)",
helpImageEditMask1: "添加遮罩图层:点击图层面板标题栏的「M」按钮;新遮罩图层插入到活动图层上方,Mask工具自动激活",
+223 -2
View File
@@ -12,6 +12,9 @@ import { ShapeTool } from "./image-edit/ShapeTool.js";
import { MaskTool } from "./image-edit/MaskTool.js";
import { MaskColorTool, MaskAlphaTool, MaskTextTool, MaskVectorTool, MaskShapeTool, MASK_TEXT_FONTS } from "./image-edit/MaskEditorOneTools.js";
import { showToast } from "./app.js";
import { comfyUI } from "./comfyui-client.js";
import { comfyEditor } from "./comfyui-editor.js";
import { comfyWorkflow } from "./comfyui-workflow.js";
const TOOL_DEFS = [
{ id: "select", icon: "▲", label: "Select", ready: true },
@@ -22,6 +25,7 @@ const TOOL_DEFS = [
{ id: "blur", icon: "≈", label: "Blur", ready: true },
{ id: "filter", icon: "★", label: "Filter", ready: true },
{ id: "bgremove", icon: "⬚", label: "BG Remove", ready: true },
{ id: "inpaint", icon: "🩹", label: "Inpaint", ready: true },
];
const UNDO_LIMIT = 20;
@@ -107,6 +111,17 @@ class ImageEditTab {
// ABR brush (Mask Editor One) — optional feature
this._abrAvailable = false;
this._abrBrushTree = [];
// Inpaint ツール
this._inpaintPositive = "";
this._inpaintNegative = "";
this._inpaintGrowMaskBy = null; // null = 未初期化(ワークフローの現在値から初期化)
this._inpaintDenoise = null; // null = 未初期化(ワークフローの現在値から初期化)
this._inpaintRunning = false;
this._inpaintResultUrl = null;
// Inpaint 専用ワークフロー(OFF時は GenerateUI で読み込み中のワークフローを使用)
this._inpaintUseDedicated = false;
this._inpaintDedicatedFilename = null;
this._inpaintWorkflowList = [];
}
// ── 初期化 ────────────────────────────────────
@@ -124,6 +139,20 @@ class ImageEditTab {
this._checkBiRefNetAvailability();
this._checkSam3Availability();
this._checkAbrAvailability();
// Inpaint「専用ワークフロー」選択肢のため、保存済みワークフロー一覧を取得
this._fetchInpaintWorkflowList();
}
async _fetchInpaintWorkflowList() {
try {
const resp = await fetch(`${comfyUI.baseUrl}/api/wfm/workflows`);
if (!resp.ok) return;
const list = await resp.json();
this._inpaintWorkflowList = (list || []).map((w) => w.filename).filter(Boolean);
if (this._activeTool === "inpaint") this._renderInpaintProps();
} catch {
this._inpaintWorkflowList = [];
}
}
async _checkBiRefNetAvailability() {
@@ -243,8 +272,8 @@ class ImageEditTab {
overlay.getContext("2d").clearRect(0, 0, overlay.width, overlay.height);
}
}
// Draw/Mask以外に切り替えたらプロパティペインを非表示
if (toolId !== "mask" && toolId !== "draw") {
// Draw/Mask/Inpaint以外に切り替えたらプロパティペインを非表示
if (toolId !== "mask" && toolId !== "draw" && toolId !== "inpaint") {
const pane = document.getElementById("ie-props-pane");
if (pane) pane.style.display = "none";
}
@@ -689,6 +718,10 @@ class ImageEditTab {
document.getElementById("ie-gmic-open-btn")?.addEventListener("click", () => this._gmicOpenGui());
document.getElementById("ie-gmic-apply-btn")?.addEventListener("click", () => this._gmicApplyResult());
document.getElementById("ie-gmic-abort-btn")?.addEventListener("click", () => this._gmicAbort());
} else if (toolId === "inpaint") {
el.innerHTML = "";
this._renderInpaintProps();
} else {
const def = TOOL_DEFS.find(d => d.id === toolId);
el.innerHTML = `<span style="font-size:12px;color:var(--wfm-text-secondary);">${def?.label ?? toolId}: coming soon</span>`;
@@ -1230,6 +1263,194 @@ class ImageEditTab {
return canvas;
}
// ── Inpaint ツール ─────────────────────────────
// マスクレイヤー(透過背景+白ペイント)を黒背景に合成し、白=インペイント対象/黒=維持の
// 不透明なグレースケールPNGとして書き出す(LayerのgetThumbnailDataURLと同じ規約)。
_exportMaskCanvas(maskLayer) {
const w = maskLayer.canvas.width, h = maskLayer.canvas.height;
const canvas = document.createElement("canvas");
canvas.width = w; canvas.height = h;
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, w, h);
ctx.drawImage(maskLayer.canvas, 0, 0);
return canvas;
}
_renderInpaintProps() {
const pane = document.getElementById("ie-props-pane");
const body = document.getElementById("ie-props-body");
const title = document.getElementById("ie-props-title");
if (!pane || !body) return;
pane.style.display = "flex";
if (title) title.textContent = "Inpaint";
// 未初期化ならワークフローの現在値から初期化(VAEEncodeForInpaint.grow_mask_by / KSampler.denoise)
if (this._inpaintGrowMaskBy == null) {
this._inpaintGrowMaskBy = comfyUI.currentAnalysis?.inpaint_encode_nodes?.[0]?.grow_mask_by ?? 6;
}
if (this._inpaintDenoise == null) {
const samplerNode = (comfyUI.currentAnalysis?.sampler_nodes || []).find((n) => n.denoise !== undefined);
this._inpaintDenoise = samplerNode?.denoise ?? 1.0;
}
body.innerHTML = `
<div class="ie-props-row">
<label style="display:flex;align-items:center;gap:6px;cursor:pointer;">
<input type="checkbox" id="ie-inpaint-use-dedicated" ${this._inpaintUseDedicated ? "checked" : ""}>
Use dedicated workflow
</label>
</div>
<div class="ie-props-row" id="ie-inpaint-dedicated-row" style="${this._inpaintUseDedicated ? "" : "display:none;"}">
<select id="ie-inpaint-dedicated-select" style="flex:1;">
<option value="">-- select workflow --</option>
${this._inpaintWorkflowList.map((f) => `<option value="${f}" ${f === this._inpaintDedicatedFilename ? "selected" : ""}>${f}</option>`).join("")}
</select>
</div>
<div class="ie-props-row" style="flex-direction:column;align-items:stretch;">
<label>Positive Prompt</label>
<textarea id="ie-inpaint-positive" rows="3" style="width:100%;resize:vertical;font-size:12px;">${this._inpaintPositive}</textarea>
</div>
<div class="ie-props-row" style="flex-direction:column;align-items:stretch;">
<label>Negative Prompt</label>
<textarea id="ie-inpaint-negative" rows="3" style="width:100%;resize:vertical;font-size:12px;">${this._inpaintNegative}</textarea>
</div>
<div class="ie-props-row">
<label>Grow Mask By</label>
<input type="number" id="ie-inpaint-grow-mask" min="0" max="200" step="1" value="${this._inpaintGrowMaskBy}" style="width:60px;">
</div>
<div class="ie-props-row">
<label>Denoise</label>
<input type="number" id="ie-inpaint-denoise" min="0" max="1" step="0.01" value="${this._inpaintDenoise}" style="width:60px;">
</div>
<div class="ie-props-row">
<button class="wfm-btn wfm-btn-sm wfm-btn-primary" id="ie-inpaint-run-btn" style="flex:1;" ${this._inpaintRunning ? "disabled" : ""}>
${this._inpaintRunning ? "Running..." : "Run"}
</button>
</div>
<span id="ie-inpaint-status" style="font-size:11px;color:var(--wfm-text-secondary);"></span>
${this._inpaintResultUrl ? `
<div class="ie-props-row" style="flex-direction:column;align-items:stretch;">
<label>Result</label>
<img src="${this._inpaintResultUrl}" style="max-width:100%;border-radius:var(--wfm-radius-sm);border:1px solid var(--wfm-border);">
</div>
` : ""}
`;
document.getElementById("ie-inpaint-use-dedicated")?.addEventListener("change", e => {
this._inpaintUseDedicated = e.target.checked;
this._renderInpaintProps();
});
document.getElementById("ie-inpaint-dedicated-select")?.addEventListener("change", e => {
this._inpaintDedicatedFilename = e.target.value || null;
});
document.getElementById("ie-inpaint-positive")?.addEventListener("input", e => { this._inpaintPositive = e.target.value; });
document.getElementById("ie-inpaint-negative")?.addEventListener("input", e => { this._inpaintNegative = e.target.value; });
document.getElementById("ie-inpaint-grow-mask")?.addEventListener("input", e => {
this._inpaintGrowMaskBy = parseInt(e.target.value) || 0;
});
document.getElementById("ie-inpaint-denoise")?.addEventListener("input", e => {
this._inpaintDenoise = Math.max(0, Math.min(1, parseFloat(e.target.value)));
if (Number.isNaN(this._inpaintDenoise)) this._inpaintDenoise = 1.0;
});
document.getElementById("ie-inpaint-run-btn")?.addEventListener("click", () => this._runInpaint());
}
async _runInpaint() {
if (this._inpaintRunning) return;
if (!this._layerMgr) { showToast("No image loaded", "error"); return; }
const maskLayer = (this._layerMgr.activeLayer?.type === "mask")
? this._layerMgr.activeLayer
: this._layerMgr.layers.find(l => l.type === "mask");
if (!maskLayer) { showToast("Create a mask layer first (Mask tool)", "info"); return; }
if (this._inpaintUseDedicated) {
if (!this._inpaintDedicatedFilename) { showToast("Select a dedicated workflow first", "info"); return; }
} else if (!comfyUI.currentAnalysis) {
showToast("Load a workflow in GenerateUI first", "info");
return;
}
const runBtn = document.getElementById("ie-inpaint-run-btn");
const statusEl = document.getElementById("ie-inpaint-status");
const setStatus = (msg) => { if (statusEl) statusEl.textContent = msg; };
this._inpaintRunning = true;
if (runBtn) { runBtn.disabled = true; runBtn.textContent = "Running..."; }
setStatus(this._inpaintUseDedicated ? "Loading dedicated workflow..." : "Compositing...");
try {
// 専用ワークフロー使用時は GenerateUI の comfyUI.currentWorkflow/currentAnalysis には
// 一切触れず、ここでロード・解析したローカルなワークフロー/解析結果だけを使う。
let targetWorkflow = null;
let targetAnalysis = null;
if (this._inpaintUseDedicated) {
const resp = await fetch(`${comfyUI.baseUrl}/api/wfm/workflows/raw?filename=${encodeURIComponent(this._inpaintDedicatedFilename)}`);
if (!resp.ok) throw new Error(`Failed to load workflow (HTTP ${resp.status})`);
let dedicatedWorkflow = await resp.json();
const format = comfyWorkflow.detectFormat(dedicatedWorkflow, this._inpaintDedicatedFilename);
if (format === "ui") {
dedicatedWorkflow = await comfyWorkflow.convertUiToApi(dedicatedWorkflow);
} else if (format !== "api") {
throw new Error("Unsupported or unrecognized workflow format");
}
targetWorkflow = dedicatedWorkflow;
targetAnalysis = comfyWorkflow.analyzeWorkflow(dedicatedWorkflow);
}
// LoadImage(の MASK 出力が使われている)スロットを優先し、無ければ Mask Editor One
// ノード(LoadImage を介さず画像/マスクを内包する custom node)にフォールバックする
const analysisForLookup = targetAnalysis || comfyUI.currentAnalysis;
const slotIndex = (analysisForLookup.load_image_nodes || []).findIndex(n => n.mask_used);
const meoNode = (analysisForLookup.mask_editor_one_nodes || [])[0];
if (slotIndex === -1 && !meoNode) {
throw new Error("No inpaint-capable LoadImage or Mask Editor One node found in the workflow");
}
setStatus("Compositing...");
const bgCanvas = this._buildBgCanvas();
const imageBlob = await new Promise((resolve) => bgCanvas.toBlob(resolve, "image/png"));
const maskCanvas = this._exportMaskCanvas(maskLayer);
const maskBlob = await new Promise((resolve) => maskCanvas.toBlob(resolve, "image/png"));
const overrideOpts = targetWorkflow ? { workflow: targetWorkflow, analysis: targetAnalysis } : {};
setStatus("Uploading...");
if (slotIndex !== -1) {
await comfyEditor.applyImageAndMaskToSlot(imageBlob, maskBlob, slotIndex, overrideOpts);
} else {
await comfyEditor.applyImageAndMaskToMaskEditorOneNode(imageBlob, maskBlob, meoNode.id, overrideOpts);
}
comfyEditor.setPromptText("positive", this._inpaintPositive, overrideOpts);
comfyEditor.setPromptText("negative", this._inpaintNegative, overrideOpts);
comfyEditor.setInpaintParams({
growMaskBy: this._inpaintGrowMaskBy,
denoise: this._inpaintDenoise,
...overrideOpts,
});
if (!window._wfmGenerateTab?.generate) throw new Error("GenerateUI is not ready yet");
setStatus("Generating...");
await window._wfmGenerateTab.generate(targetWorkflow || undefined);
const resultImg = document.getElementById("wfm-gen-result-img");
if (resultImg?.src) this._inpaintResultUrl = resultImg.src;
setStatus("Done");
showToast("Inpaint generation complete", "success");
} catch (err) {
setStatus("Error");
showToast(`Inpaint failed: ${err.message}`, "error");
} finally {
this._inpaintRunning = false;
this._renderInpaintProps();
}
}
_renderMaskLayerOverlay(ctx, maskLayer) {
// アクティブなマスクレイヤーのみオーバーレイ表示(非アクティブなマスクは隠す)
if (this._layerMgr?.activeLayer !== maskLayer) return;
+2
View File
@@ -1327,6 +1327,7 @@
<li id="wfm-help-imageedit-7b">Blur (≈): apply Gaussian blur or mosaic to the active layer — whole-layer or region-based (drag a rectangle); see the Blur Tool card below for details</li>
<li id="wfm-help-imageedit-7c">BG Remove (⬚): remove the background from the active layer using Lightweight (@imgly, runs in browser) or BiRefNet (requires Mask Editor One + birefnet.safetensors in ComfyUI/models/background_removal/); see the BG Remove Tool card below for details</li>
<li id="wfm-help-imageedit-7d">Mask (🎭): paint masks on a mask layer using 6 sub-tools — Paint (freehand), Color (flood-select by similar color), Alpha (extract from image transparency), Text (stamp text), Vector (Catmull-Rom spline polygon), Shape (rect / ellipse); SAM3 text-prompt segmentation is also available when Mask Editor One is installed; click "M" in the Layers header to add a mask layer; see the Mask Tool card below for details</li>
<li id="wfm-help-imageedit-7e">Inpaint (🩹): composites the visible layers plus a Mask layer into one RGBA image (mask baked into the alpha channel) and applies it to the first inpaint-capable LoadImage node in the workflow currently loaded in GenerateUI (a node whose MASK output feeds something like VAEEncodeForInpaint); enter Positive/Negative prompts, Grow Mask By (applied to the VAE Encode (for Inpainting) node), and Denoise (applied to KSampler) in the properties panel, then click Run to upload and generate without leaving the Image Edit tab — the result is shown back in the properties panel when done; requires a Mask layer to be painted first and an inpaint-capable workflow loaded in GenerateUI; also works with workflows built around the Mask Editor One custom node (comfyui-mask-editor-one) instead of LoadImage — image/mask are pushed to it via its node_id-keyed server cache and layer_data widget; "Use dedicated workflow" checkbox: when off, the workflow currently loaded in GenerateUI is used (unchanged); when on, pick a saved workflow from the dropdown — it is loaded, edited, and generated entirely in the background without disturbing the workflow shown in GenerateUI</li>
</ul>
</div>
<div class="wfm-help-card">
@@ -1670,6 +1671,7 @@
<button class="ie-tool-btn" data-tool="blur" title="Blur">≈</button>
<button class="ie-tool-btn" data-tool="filter" title="Filter">★</button>
<button class="ie-tool-btn" data-tool="bgremove" title="BG Remove">⬚</button>
<button class="ie-tool-btn" data-tool="inpaint" title="Inpaint">🩹</button>
</div>
<!-- Center -->
+665
View File
@@ -0,0 +1,665 @@
{
"id": "6d392e45-b20b-4dee-a422-0b4a18e645cd",
"revision": 0,
"last_node_id": 35,
"last_link_id": 102,
"nodes": [
{
"id": 8,
"type": "VAEDecode",
"pos": [
1351.4570000000006,
197.9979999999999
],
"size": [
210,
46
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"localized_name": "samples",
"name": "samples",
"type": "LATENT",
"link": 42
},
{
"localized_name": "vae",
"name": "vae",
"type": "VAE",
"link": 84
}
],
"outputs": [
{
"localized_name": "IMAGE",
"name": "IMAGE",
"type": "IMAGE",
"slot_index": 0,
"links": [
22
]
}
],
"properties": {
"Node name for S&R": "VAEDecode",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": []
},
{
"id": 29,
"type": "CheckpointLoaderSimple",
"pos": [
-35,
161
],
"size": [
315,
98
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"localized_name": "ckpt_name",
"name": "ckpt_name",
"type": "COMBO",
"widget": {
"name": "ckpt_name"
},
"link": null
}
],
"outputs": [
{
"localized_name": "MODEL",
"name": "MODEL",
"type": "MODEL",
"slot_index": 0,
"links": [
80
]
},
{
"localized_name": "CLIP",
"name": "CLIP",
"type": "CLIP",
"slot_index": 1,
"links": [
81,
82
]
},
{
"localized_name": "VAE",
"name": "VAE",
"type": "VAE",
"slot_index": 2,
"links": [
84,
90
]
}
],
"properties": {
"Node name for S&R": "CheckpointLoaderSimple",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": [
"anime\\merge\\hayochamixIDXL_v11+_blueberryPlus_v10-amanatsuIllustrious_v11_x0.1_trainDifference.safetensors"
]
},
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [
330,
369
],
"size": [
412.2799987792969,
88
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"localized_name": "clip",
"name": "clip",
"type": "CLIP",
"link": 82
},
{
"localized_name": "text",
"name": "text",
"type": "STRING",
"widget": {
"name": "text"
},
"link": null
}
],
"outputs": [
{
"localized_name": "CONDITIONING",
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
6
]
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": [
"w\n"
]
},
{
"id": 32,
"type": "LoadImage",
"pos": [
-20.402179424849777,
348.01722821269084
],
"size": [
282.798828125,
314
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"localized_name": "image",
"name": "image",
"type": "COMBO",
"widget": {
"name": "image"
},
"link": null
},
{
"localized_name": "choose file to upload",
"name": "upload",
"type": "IMAGEUPLOAD",
"widget": {
"name": "upload"
},
"link": null
}
],
"outputs": [
{
"localized_name": "IMAGE",
"name": "IMAGE",
"type": "IMAGE",
"links": [
101
]
},
{
"localized_name": "MASK",
"name": "MASK",
"type": "MASK",
"links": [
102
]
}
],
"properties": {
"Node name for S&R": "LoadImage",
"ue_properties": {
"widget_ue_connectable": {},
"input_ue_unconnectable": {},
"version": "7.8"
},
"image": "clipspace/clipspace-painted-masked-1784801792090.png [input]"
},
"widgets_values": [
"clipspace/clipspace-painted-masked-1784801792090.png [input]",
"image"
]
},
{
"id": 3,
"type": "KSampler",
"pos": [
997,
174
],
"size": [
315,
474
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"localized_name": "model",
"name": "model",
"type": "MODEL",
"link": 80
},
{
"localized_name": "positive",
"name": "positive",
"type": "CONDITIONING",
"link": 4
},
{
"localized_name": "negative",
"name": "negative",
"type": "CONDITIONING",
"link": 6
},
{
"localized_name": "latent_image",
"name": "latent_image",
"type": "LATENT",
"link": 72
},
{
"localized_name": "seed",
"name": "seed",
"type": "INT",
"widget": {
"name": "seed"
},
"link": null
},
{
"localized_name": "steps",
"name": "steps",
"type": "INT",
"widget": {
"name": "steps"
},
"link": null
},
{
"localized_name": "cfg",
"name": "cfg",
"type": "FLOAT",
"widget": {
"name": "cfg"
},
"link": null
},
{
"localized_name": "sampler_name",
"name": "sampler_name",
"type": "COMBO",
"widget": {
"name": "sampler_name"
},
"link": null
},
{
"localized_name": "scheduler",
"name": "scheduler",
"type": "COMBO",
"widget": {
"name": "scheduler"
},
"link": null
},
{
"localized_name": "denoise",
"name": "denoise",
"type": "FLOAT",
"widget": {
"name": "denoise"
},
"link": null
}
],
"outputs": [
{
"localized_name": "LATENT",
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
42
]
}
],
"properties": {
"Node name for S&R": "KSampler",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": [
1008854893628621,
"randomize",
30,
4,
"ddim",
"simple",
1
]
},
{
"id": 26,
"type": "VAEEncodeForInpaint",
"pos": [
759,
169
],
"size": [
226.8000030517578,
98
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"localized_name": "pixels",
"name": "pixels",
"type": "IMAGE",
"link": 101
},
{
"localized_name": "vae",
"name": "vae",
"type": "VAE",
"link": 90
},
{
"localized_name": "mask",
"name": "mask",
"type": "MASK",
"link": 102
},
{
"localized_name": "grow_mask_by",
"name": "grow_mask_by",
"type": "INT",
"widget": {
"name": "grow_mask_by"
},
"link": null
}
],
"outputs": [
{
"localized_name": "LATENT",
"name": "LATENT",
"type": "LATENT",
"slot_index": 0,
"links": [
72
]
}
],
"properties": {
"Node name for S&R": "VAEEncodeForInpaint",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": [
6
]
},
{
"id": 9,
"type": "SaveImage",
"pos": [
1362.0710000000008,
369.32099999999986
],
"size": [
210,
270
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"localized_name": "images",
"name": "images",
"type": "IMAGE",
"link": 22
},
{
"localized_name": "filename_prefix",
"name": "filename_prefix",
"type": "STRING",
"widget": {
"name": "filename_prefix"
},
"link": null
}
],
"outputs": [
{
"localized_name": "images",
"name": "images",
"type": "IMAGE",
"links": null
}
],
"properties": {
"Node name for S&R": "SaveImage",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": [
"ComfyUI"
]
},
{
"id": 6,
"type": "CLIPTextEncode",
"pos": [
326.97,
160
],
"size": [
422.8500061035156,
164.30999755859375
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"localized_name": "clip",
"name": "clip",
"type": "CLIP",
"link": 81
},
{
"localized_name": "text",
"name": "text",
"type": "STRING",
"widget": {
"name": "text"
},
"link": null
}
],
"outputs": [
{
"localized_name": "CONDITIONING",
"name": "CONDITIONING",
"type": "CONDITIONING",
"slot_index": 0,
"links": [
4
]
}
],
"properties": {
"Node name for S&R": "CLIPTextEncode",
"cnr_id": "comfy-core",
"ver": "0.3.18",
"ue_properties": {
"widget_ue_connectable": {},
"version": "7.8",
"input_ue_unconnectable": {}
}
},
"widgets_values": [
"smile"
]
}
],
"links": [
[
4,
6,
0,
3,
1,
"CONDITIONING"
],
[
6,
7,
0,
3,
2,
"CONDITIONING"
],
[
22,
8,
0,
9,
0,
"IMAGE"
],
[
42,
3,
0,
8,
0,
"LATENT"
],
[
72,
26,
0,
3,
3,
"LATENT"
],
[
80,
29,
0,
3,
0,
"MODEL"
],
[
81,
29,
1,
6,
0,
"CLIP"
],
[
82,
29,
1,
7,
0,
"CLIP"
],
[
84,
29,
2,
8,
1,
"VAE"
],
[
90,
29,
2,
26,
1,
"VAE"
],
[
101,
32,
0,
26,
0,
"IMAGE"
],
[
102,
32,
1,
26,
2,
"MASK"
]
],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.9229599817706418,
"offset": [
365.6203139679832,
118.10373545614928
]
},
"ue_links": [],
"links_added_by_ue": []
},
"version": 0.4
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB