The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Watermark Remover: settings from the GPU test
Adarsh52b766d3f90d
diff --git a/scripts/comfy/hand-built/image-watermark-remove-qwen21-brush.json b/scripts/comfy/hand-built/image-watermark-remove-qwen21-brush.jsonindex 6473851b..b2eb5162 100644--- a/scripts/comfy/hand-built/image-watermark-remove-qwen21-brush.json+++ b/scripts/comfy/hand-built/image-watermark-remove-qwen21-brush.json@@ -26,9 +26,9 @@],"mode": "manual_mask","boxes_json": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",- "detection_side": 1024,+ "detection_side": 1536,"expand": 20,- "max_tokens": 512,+ "max_tokens": 2048,"hint": "","edit_prompt": "","padding_ratio": 0.35,@@ -74,7 +74,7 @@],"context_pixels": 96,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 5,"edit_prompt": ["3",@@ -273,7 +273,7 @@],"context_pixels": 128,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 3,"edit_prompt": ["26",diff --git a/scripts/comfy/hand-built/image-watermark-remove-qwen21.json b/scripts/comfy/hand-built/image-watermark-remove-qwen21.jsonindex 91936c13..2c1d6c38 100644--- a/scripts/comfy/hand-built/image-watermark-remove-qwen21.json+++ b/scripts/comfy/hand-built/image-watermark-remove-qwen21.json@@ -26,9 +26,9 @@],"mode": "auto_qwen","boxes_json": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",- "detection_side": 1024,+ "detection_side": 1536,"expand": 20,- "max_tokens": 512,+ "max_tokens": 2048,"hint": "","edit_prompt": "","padding_ratio": 0.35,@@ -74,7 +74,7 @@],"context_pixels": 96,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 5,"edit_prompt": ["3",@@ -273,7 +273,7 @@],"context_pixels": 128,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 3,"edit_prompt": ["26",diff --git a/scripts/comfy/hand-built/image-watermark-scan-qwen3vl.json b/scripts/comfy/hand-built/image-watermark-scan-qwen3vl.jsonindex 0cba1985..77e78827 100644--- a/scripts/comfy/hand-built/image-watermark-scan-qwen3vl.json+++ b/scripts/comfy/hand-built/image-watermark-scan-qwen3vl.json@@ -26,9 +26,9 @@],"mode": "auto_qwen","boxes_json": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",- "detection_side": 1024,+ "detection_side": 1536,"expand": 20,- "max_tokens": 512,+ "max_tokens": 2048,"hint": "","edit_prompt": "","padding_ratio": 0.35,diff --git a/scripts/comfy/library.spec.mjs b/scripts/comfy/library.spec.mjsindex 0aa541d1..a9743909 100644--- a/scripts/comfy/library.spec.mjs+++ b/scripts/comfy/library.spec.mjs@@ -2843,7 +2843,7 @@ export const SPEC = [license: 'Qwen3-VL 8B Apache-2.0; ComfyUI-Qwen-Watermark nodes MIT',notes:'The pack\'s detect-only workflow (qwen_watermark_detection.api.json) without its preview and save nodes: QWMDetect auto_qwen reads the picture once with ' +- 'Qwen3-VL 8B (int8, detection side 1024, expand 20, padding 0.35, min confidence 0.65) and PreviewAny shows its report, the only output: JSON ' ++ 'Qwen3-VL 8B (int8, detection side 1536, up to 2048 tokens so a mark tiled over the photo comes back one box per copy, expand 20, padding 0.35, min confidence 0.65) and PreviewAny shows its report, the only output: JSON ' +'{coordinate_space: "pixels", image_size, boxes: [{label, bbox (padded repair box), source_bbox (tight), overlay_type, mask_method, confidence}], ' +'rejected_boxes (below 0.65), status}. The app draws source_bbox and sends the kept boxes to image-watermark-remove-qwen21. ' +'The GPU pre-flight also checks image-watermark-remove-qwen21 for a scan (its companion graph).',@@ -2868,9 +2868,9 @@ export const SPEC = [license: 'Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only; Qwen3-VL 8B Apache-2.0; SAM ViT-B (segment-anything) Apache-2.0; ComfyUI-Qwen-Watermark nodes MIT',notes:'The pack\'s main workflow (qwen21_watermark.api.json, plain settings) with the int8 UNET (qwen_image_2.1_int8_convrot, as Live edit) and without its ' +- 'debug save and preview nodes. QWMDetect (manual_boxes with the kept boxes and no extra margin, since the scan\'s boxes carry it; auto_qwen with ' ++ 'debug save and preview nodes. QWMDetect (manual_boxes with the kept boxes and a 32 px repair margin past the scan\'s box; auto_qwen with ' +'expand 20 for API callers) -> QWMRefineMask (a rectangle for text, logos, ' +- 'blocks and mosaics, a SAM ViT-B outline for stickers) -> QWMPrepare (context 96, max side maxSize, OpenCV pre-fill) -> Qwen-Image 2.1 edit, 20 steps, ' ++ 'blocks and mosaics, a SAM ViT-B outline for stickers) -> QWMPrepare (context 96, max side maxSize, no pre-fill: the OpenCV pre-fill smeared the pattern of a mosaic into a large box) -> Qwen-Image 2.1 edit, 20 steps, ' +'cfg 1 -> QWMComposite (feather 6, align, colour match) -> QWMResidualDetect (Qwen3-VL looks for leftovers inside the first mask) -> one more pass ' +'when it finds some -> QWMFinal keeps the better pass and raises when any pixel outside the mask changed. Outputs: the picture (SaveImage, PNG) and ' +'the quality report (PreviewAny, role quality: folded into the picture\'s meta, never a result of its own). Seeds are random per run. ' +diff --git a/scripts/comfy/validate-workflows.mjs b/scripts/comfy/validate-workflows.mjsindex eaebbd40..b7e22aeb 100644--- a/scripts/comfy/validate-workflows.mjs+++ b/scripts/comfy/validate-workflows.mjs@@ -108,6 +108,10 @@ function sampleValue(key, entry, uploads) {case 'lora': return 'fuobe_validate_lora.safetensors';case 'loraStrength': return 0.8;case 'cameraMotion': return 'Pan Left';+ // Watermark remover: the kept marks the app sends (manual_boxes), with the repair margin.+ case 'detectMode': return 'manual_boxes';+ case 'boxes': return JSON.stringify({ coordinate_space: 'pixels', boxes: [{ bbox: [8, 8, 40, 24], overlay_type: 'text_logo', label: 'text' }] });+ case 'detectExpand': return 32;case 'filenamePrefix': return `fuobe/validate/${entry.id}`;default:if (entry.defaults && entry.defaults[key] !== undefined) return entry.defaults[key];diff --git a/src/lib/watermark.ts b/src/lib/watermark.tsindex 6b00e2ad..ba91bd66 100644--- a/src/lib/watermark.ts+++ b/src/lib/watermark.ts@@ -26,11 +26,15 @@ export const MAX_LABEL = 80;export const MAX_SIDE = 4096;/** Marks the scan was less sure of are shown off (kept) at first. */export const SURE = 0.65;+/** A mark whose repair box covers more of the picture than this is shown off at first: repairing it would redraw most of the photo. */+export const BIG_SHARE = 0.4;/*** The scan's own margin around a mark (the scan graph's QWMDetect: expand 20, padding 0.35, capped per kind as the pack* caps it). The sure marks come back with it; the less sure ones come back tight and get it here.*/export const SCAN_EXPAND = 20;+/** The repair margin added around the kept marks: a scan box can stop a few pixels short of a soft mark edge. */+export const KEPT_EXPAND = 32;const PAD: Record<(typeof OVERLAY_TYPES)[number], number> = {text_logo: 0.12,translucent_text_logo: 0.35,@@ -184,7 +188,8 @@ export function parseScanReport(text: string | undefined | null): ScanResult | nconst tight = (box4(it.source_bbox) && ordered(box4(it.source_bbox)!, width, height)) || given;const repair = on ? given : padBox(tight, type, width, height);const label = cleanLabel(it.label);- const sure = on && (!finite(it.confidence) || it.confidence >= SURE);+ const big = (repair[2] - repair[0]) * (repair[3] - repair[1]) > BIG_SHARE * width * height;+ const sure = on && !big && (!finite(it.confidence) || it.confidence >= SURE);regions.push({ id: `r${regions.length + 1}`, type, label, chip: chipFor(type, label), box: tight, repair, on: sure, background: cleanLabel(it.background) });}};diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.tsindex cebb66bf..5d4dfad6 100644--- a/src/server/providers/comfyui.ts+++ b/src/server/providers/comfyui.ts@@ -45,7 +45,7 @@ import { fpsPlan } from "@/lib/av/fps";import { resolveWorkflowId } from "@/lib/comfy-variants";import { MOTION_GRAPHS, motionTransferPrompt, neutralPrompt, WORDS_NEEDED } from "@/lib/comfy-prompts";import { DECODER_PARAM, editCanvas, GPU_PARAM, LIGHTNING_GRAPHS, lightningSigmas, SPEED_PARAM, ZEN_ADAPTER, ZEN_ENCODER } from "@/lib/qwen21-speed";-import { checkWatermarkBoxes, COPY as WATERMARK_COPY, MAX_SIDE as MAX_WATERMARK_SIDE, maxSideFor, qualityOf, SCAN_EXPAND as WATERMARK_SCAN_EXPAND } from "@/lib/watermark";+import { checkWatermarkBoxes, COPY as WATERMARK_COPY, MAX_SIDE as MAX_WATERMARK_SIDE, maxSideFor, qualityOf, SCAN_EXPAND as WATERMARK_SCAN_EXPAND, KEPT_EXPAND as WATERMARK_KEPT_EXPAND } from "@/lib/watermark";import { h3Canvas, h3Frames, isH3Graph } from "@/lib/h3-prompt";import { draftSizeFor, REGEN_COPY, REGEN_WINDOW_SECONDS, REGEN_WORKFLOW, regenFrames, regenOnePassRefusal, regenResolution } from "@/lib/catalog/regenerate";import { carriesBoxes, LAYOUT_PARAM } from "@/lib/layout-prompt";@@ -1760,8 +1760,8 @@ export async function prepareWorkflow(endpointTemplate: string, input: GenInput,}values.detectMode = "manual_boxes";} else if (b.detectMode) values.detectMode = brushed ? "manual_mask" : "auto_qwen";- // The kept marks already carry the scan's margin; marks the pack finds itself (an API caller's run) get it here.- if (b.detectExpand) values.detectExpand = values.detectMode === "manual_boxes" ? 0 : WATERMARK_SCAN_EXPAND;+ // The kept marks get a repair margin past the scan's box; marks the pack finds itself (an API caller's run) get the scan's.+ if (b.detectExpand) values.detectExpand = values.detectMode === "manual_boxes" ? WATERMARK_KEPT_EXPAND : WATERMARK_SCAN_EXPAND;if (b.maxSize) values.maxSize = maxSideFor(still?.width, still?.height, await ctx.vram?.().catch(() => undefined));for (const k of ["boxes", "detectMode", "detectExpand", "maxSize", "image", "mask", "seed", "filenamePrefix"]) delete extra[k];}diff --git a/tests/watermark-remover.test.ts b/tests/watermark-remover.test.tsindex 6b630e59..02af8893 100644--- a/tests/watermark-remover.test.ts+++ b/tests/watermark-remover.test.ts@@ -230,8 +230,8 @@ describe("8. how the provider fills the removal", () => {expect(wf["1"].inputs.image).toBe("a.png");expect(wf["3"].inputs.mode).toBe("manual_boxes");expect(JSON.parse(String(wf["3"].inputs.boxes_json))).toEqual({ coordinate_space: "pixels", boxes: [{ bbox: [0, 20, 1200, 120], overlay_type: "unknown", label: "caption" }] });- // The kept boxes carry the scan's margin already: no second one.- expect(wf["3"].inputs.expand).toBe(0);+ // The kept boxes get the repair margin past the scan's box.+ expect(wf["3"].inputs.expand).toBe(W.KEPT_EXPAND);});it("kept marks keep the scan's words for what is around them, for the repair", async () => {@@ -344,6 +344,13 @@ describe("10. the scan report, read into regions", () => {expect(W.parseScanReport(JSON.stringify({ coordinate_space: "pixels", image_size: [10, 10], boxes: [] }))!.regions).toEqual([]);});+ it("starts a mark that covers most of the picture kept, since its repair would redraw the photo", () => {+ const report = (bbox: number[]) => JSON.stringify({ coordinate_space: "pixels", image_size: [1000, 800], boxes: [{ bbox, source_bbox: bbox, overlay_type: "text_logo", label: "text", confidence: 0.9 }] });+ expect(W.parseScanReport(report([0, 0, 1000, 800]))!.regions[0].on).toBe(false);+ expect(W.parseScanReport(report([0, 0, 1000, 500]))!.regions[0].on).toBe(false);+ expect(W.parseScanReport(report([100, 100, 600, 600]))!.regions[0].on).toBe(true);+ });+it("names the chips from the type and the scan's words", () => {expect(W.chipFor("text_logo", "a website URL")).toBe("Text");expect(W.chipFor("translucent_text_logo", "©2024 photographer signature")).toBe("Text");diff --git a/workflows/comfyui/image-watermark-remove-qwen21-brush.json b/workflows/comfyui/image-watermark-remove-qwen21-brush.jsonindex 6473851b..b2eb5162 100644--- a/workflows/comfyui/image-watermark-remove-qwen21-brush.json+++ b/workflows/comfyui/image-watermark-remove-qwen21-brush.json@@ -26,9 +26,9 @@],"mode": "manual_mask","boxes_json": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",- "detection_side": 1024,+ "detection_side": 1536,"expand": 20,- "max_tokens": 512,+ "max_tokens": 2048,"hint": "","edit_prompt": "","padding_ratio": 0.35,@@ -74,7 +74,7 @@],"context_pixels": 96,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 5,"edit_prompt": ["3",@@ -273,7 +273,7 @@],"context_pixels": 128,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 3,"edit_prompt": ["26",diff --git a/workflows/comfyui/image-watermark-remove-qwen21.json b/workflows/comfyui/image-watermark-remove-qwen21.jsonindex 91936c13..2c1d6c38 100644--- a/workflows/comfyui/image-watermark-remove-qwen21.json+++ b/workflows/comfyui/image-watermark-remove-qwen21.json@@ -26,9 +26,9 @@],"mode": "auto_qwen","boxes_json": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",- "detection_side": 1024,+ "detection_side": 1536,"expand": 20,- "max_tokens": 512,+ "max_tokens": 2048,"hint": "","edit_prompt": "","padding_ratio": 0.35,@@ -74,7 +74,7 @@],"context_pixels": 96,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 5,"edit_prompt": ["3",@@ -273,7 +273,7 @@],"context_pixels": 128,"max_side": 1024,- "pre_inpaint": "auto",+ "pre_inpaint": "none","inpaint_radius": 3,"edit_prompt": ["26",diff --git a/workflows/comfyui/image-watermark-scan-qwen3vl.json b/workflows/comfyui/image-watermark-scan-qwen3vl.jsonindex 0cba1985..77e78827 100644--- a/workflows/comfyui/image-watermark-scan-qwen3vl.json+++ b/workflows/comfyui/image-watermark-scan-qwen3vl.json@@ -26,9 +26,9 @@],"mode": "auto_qwen","boxes_json": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",- "detection_side": 1024,+ "detection_side": 1536,"expand": 20,- "max_tokens": 512,+ "max_tokens": 2048,"hint": "","edit_prompt": "","padding_ratio": 0.35,diff --git a/workflows/comfyui/manifest.json b/workflows/comfyui/manifest.jsonindex 745ab5f2..d68a7d57 100644--- a/workflows/comfyui/manifest.json+++ b/workflows/comfyui/manifest.json@@ -10893,7 +10893,7 @@"vramGb": 10,"license": "Qwen3-VL 8B Apache-2.0; ComfyUI-Qwen-Watermark nodes MIT","validated": false,- "notes": "The pack's detect-only workflow (qwen_watermark_detection.api.json) without its preview and save nodes: QWMDetect auto_qwen reads the picture once with Qwen3-VL 8B (int8, detection side 1024, expand 20, padding 0.35, min confidence 0.65) and PreviewAny shows its report, the only output: JSON {coordinate_space: \"pixels\", image_size, boxes: [{label, bbox (padded repair box), source_bbox (tight), overlay_type, mask_method, confidence}], rejected_boxes (below 0.65), status}. The app draws source_bbox and sends the kept boxes to image-watermark-remove-qwen21. The GPU pre-flight also checks image-watermark-remove-qwen21 for a scan (its companion graph)."+ "notes": "The pack's detect-only workflow (qwen_watermark_detection.api.json) without its preview and save nodes: QWMDetect auto_qwen reads the picture once with Qwen3-VL 8B (int8, detection side 1536, up to 2048 tokens so a mark tiled over the photo comes back one box per copy, expand 20, padding 0.35, min confidence 0.65) and PreviewAny shows its report, the only output: JSON {coordinate_space: \"pixels\", image_size, boxes: [{label, bbox (padded repair box), source_bbox (tight), overlay_type, mask_method, confidence}], rejected_boxes (below 0.65), status}. The app draws source_bbox and sends the kept boxes to image-watermark-remove-qwen21. The GPU pre-flight also checks image-watermark-remove-qwen21 for a scan (its companion graph)."},{"id": "image-watermark-remove-qwen21",@@ -11006,7 +11006,7 @@"vramGb": 20,"license": "Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only; Qwen3-VL 8B Apache-2.0; SAM ViT-B (segment-anything) Apache-2.0; ComfyUI-Qwen-Watermark nodes MIT","validated": false,- "notes": "The pack's main workflow (qwen21_watermark.api.json, plain settings) with the int8 UNET (qwen_image_2.1_int8_convrot, as Live edit) and without its debug save and preview nodes. QWMDetect (manual_boxes with the kept boxes and no extra margin, since the scan's boxes carry it; auto_qwen with expand 20 for API callers) -> QWMRefineMask (a rectangle for text, logos, blocks and mosaics, a SAM ViT-B outline for stickers) -> QWMPrepare (context 96, max side maxSize, OpenCV pre-fill) -> Qwen-Image 2.1 edit, 20 steps, cfg 1 -> QWMComposite (feather 6, align, colour match) -> QWMResidualDetect (Qwen3-VL looks for leftovers inside the first mask) -> one more pass when it finds some -> QWMFinal keeps the better pass and raises when any pixel outside the mask changed. Outputs: the picture (SaveImage, PNG) and the quality report (PreviewAny, role quality: folded into the picture's meta, never a result of its own). Seeds are random per run. The structure settings (denoise 0.65 / 0.55, context 384, no pre-fill) are the pack's alternative for faces."+ "notes": "The pack's main workflow (qwen21_watermark.api.json, plain settings) with the int8 UNET (qwen_image_2.1_int8_convrot, as Live edit) and without its debug save and preview nodes. QWMDetect (manual_boxes with the kept boxes and a 32 px repair margin past the scan's box; auto_qwen with expand 20 for API callers) -> QWMRefineMask (a rectangle for text, logos, blocks and mosaics, a SAM ViT-B outline for stickers) -> QWMPrepare (context 96, max side maxSize, no pre-fill: the OpenCV pre-fill smeared the pattern of a mosaic into a large box) -> Qwen-Image 2.1 edit, 20 steps, cfg 1 -> QWMComposite (feather 6, align, colour match) -> QWMResidualDetect (Qwen3-VL looks for leftovers inside the first mask) -> one more pass when it finds some -> QWMFinal keeps the better pass and raises when any pixel outside the mask changed. Outputs: the picture (SaveImage, PNG) and the quality report (PreviewAny, role quality: folded into the picture's meta, never a result of its own). Seeds are random per run. The structure settings (denoise 0.65 / 0.55, context 384, no pre-fill) are the pack's alternative for faces."},{"id": "image-watermark-remove-qwen21-brush",diff --git a/workflows/comfyui/object_info.subset.json b/workflows/comfyui/object_info.subset.jsonindex 6afb3617..1ab877e8 100644--- a/workflows/comfyui/object_info.subset.json+++ b/workflows/comfyui/object_info.subset.json@@ -17359,6 +17359,641 @@"essentials_category": "Basics","has_intermediate_output": false},+ "QWMComposite": {+ "input": {+ "required": {+ "original": [+ "IMAGE"+ ],+ "edited_crop": [+ "IMAGE"+ ],+ "mask": [+ "MASK"+ ],+ "geometry": [+ "QWM_GEOMETRY"+ ],+ "feather": [+ "INT",+ {+ "default": 6,+ "min": 0,+ "max": 64,+ "tooltip": "贴回边缘的颜色过渡宽度(原图像素)。只缓和边界色差,不能补齐漏选范围;残影应调 expand/dilation。"+ }+ ],+ "align": [+ "BOOLEAN",+ {+ "default": true,+ "tooltip": "根据遮罩外上下文估计小幅位移并对齐。报告出现 warning 时应人工检查。"+ }+ ]+ },+ "optional": {+ "color_match": [+ "BOOLEAN",+ {+ "default": true,+ "tooltip": "用遮罩外配对像素做有限 RGB 校正,减少局部色漂;不把原遮挡像素混回生成结果。"+ }+ ]+ }+ },+ "input_order": {+ "required": [+ "original",+ "edited_crop",+ "mask",+ "geometry",+ "feather",+ "align"+ ],+ "optional": [+ "color_match"+ ]+ },+ "is_input_list": false,+ "output": [+ "IMAGE",+ "IMAGE",+ "STRING"+ ],+ "output_is_list": [+ false,+ false,+ false+ ],+ "output_name": [+ "restored_image",+ "comparison",+ "report"+ ],+ "name": "QWMComposite",+ "display_name": "06 对齐 / 保色贴回",+ "description": "",+ "python_module": "custom_nodes.ComfyUI-Qwen-Watermark",+ "category": "Qwen Watermark",+ "output_node": false,+ "has_intermediate_output": false,+ "search_aliases": []+ },+ "QWMDetect": {+ "input": {+ "required": {+ "image": [+ "IMAGE"+ ],+ "mode": [+ [+ "auto_qwen",+ "manual_boxes",+ "manual_mask"+ ]+ ],+ "boxes_json": [+ "STRING",+ {+ "default": "{\"coordinate_space\":\"pixels\",\"boxes\":[]}",+ "multiline": true,+ "tooltip": "手动框 JSON。坐标可用像素、xyxy_1000 或 normalized;auto_qwen 模式会用模型输出覆盖它。"+ }+ ],+ "detection_side": [+ "INT",+ {+ "default": 1024,+ "min": 256,+ "max": 2048,+ "step": 32,+ "tooltip": "送入 Qwen3-VL 的定位图最长边。越大越容易看清小 Logo,显存和耗时也随之增加。"+ }+ ],+ "expand": [+ "INT",+ {+ "default": 8,+ "min": 0,+ "max": 64,+ "tooltip": "矩形框向外扩的像素数,用于覆盖描边、阴影和接缝。它只影响 box 范围,不负责羽化。"+ }+ ],+ "max_tokens": [+ "INT",+ {+ "default": 512,+ "min": 64,+ "max": 2048,+ "tooltip": "定位模型输出 JSON 的最大 token 数。多水印或复杂描述时增加;普通图片保持 512。"+ }+ ],+ "hint": [+ "STRING",+ {+ "default": "",+ "multiline": true,+ "tooltip": "给定位模型的补充线索,例如“左下角灰色文字”和“右下角圆形 Logo”;不改变编辑指令。"+ }+ ],+ "edit_prompt": [+ "STRING",+ {+ "default": "",+ "multiline": true,+ "tooltip": "给 Qwen Image 的补充编辑要求。写保留结构、材质和位置约束;不要只写“去水印”。"+ }+ ],+ "padding_ratio": [+ "FLOAT",+ {+ "default": 0.35,+ "min": 0,+ "max": 1,+ "step": 0.05,+ "tooltip": "自动检测框按比例扩边;程序会按水印类型设上限。手动框模式不使用此比例。"+ }+ ]+ },+ "optional": {+ "clip": [+ "CLIP"+ ],+ "manual_mask": [+ "MASK"+ ],+ "min_confidence": [+ "FLOAT",+ {+ "default": 0.65,+ "min": 0,+ "max": 1,+ "tooltip": "保留自动候选的最低置信度。调高可减少误检,调低可减少低对比水印漏检;低于 0.65 的结果应人工确认。"+ }+ ]+ }+ },+ "input_order": {+ "required": [+ "image",+ "mode",+ "boxes_json",+ "detection_side",+ "expand",+ "max_tokens",+ "hint",+ "edit_prompt",+ "padding_ratio"+ ],+ "optional": [+ "clip",+ "manual_mask",+ "min_confidence"+ ]+ },+ "is_input_list": false,+ "output": [+ "MASK",+ "STRING",+ "IMAGE",+ "STRING"+ ],+ "output_is_list": [+ false,+ false,+ false,+ false+ ],+ "output_name": [+ "watermark_mask",+ "boxes_json",+ "preview",+ "edit_prompt"+ ],+ "name": "QWMDetect",+ "display_name": "02 自动定位 / 手动改框",+ "description": "",+ "python_module": "custom_nodes.ComfyUI-Qwen-Watermark",+ "category": "Qwen Watermark",+ "output_node": false,+ "has_intermediate_output": false,+ "search_aliases": []+ },+ "QWMFinal": {+ "input": {+ "required": {+ "original": [+ "IMAGE"+ ],+ "initial_mask": [+ "MASK"+ ],+ "detection_report": [+ "STRING"+ ]+ },+ "optional": {+ "first_pass": [+ "IMAGE",+ {+ "lazy": true+ }+ ],+ "first_report": [+ "STRING",+ {+ "lazy": true+ }+ ],+ "residual_report": [+ "STRING",+ {+ "lazy": true+ }+ ],+ "second_pass": [+ "IMAGE",+ {+ "lazy": true+ }+ ],+ "second_report": [+ "STRING",+ {+ "lazy": true+ }+ ],+ "residual_mask": [+ "MASK",+ {+ "lazy": true+ }+ ]+ }+ },+ "input_order": {+ "required": [+ "original",+ "initial_mask",+ "detection_report"+ ],+ "optional": [+ "first_pass",+ "first_report",+ "residual_report",+ "second_pass",+ "second_report",+ "residual_mask"+ ]+ },+ "is_input_list": false,+ "output": [+ "IMAGE",+ "IMAGE",+ "STRING"+ ],+ "output_is_list": [+ false,+ false,+ false+ ],+ "output_name": [+ "final_image",+ "comparison",+ "quality_report"+ ],+ "name": "QWMFinal",+ "display_name": "12 质量检查 / 选择最终结果",+ "description": "",+ "python_module": "custom_nodes.ComfyUI-Qwen-Watermark",+ "category": "Qwen Watermark",+ "output_node": false,+ "has_intermediate_output": false,+ "search_aliases": []+ },+ "QWMPrepare": {+ "input": {+ "required": {+ "image": [+ "IMAGE"+ ],+ "mask": [+ "MASK"+ ],+ "context_pixels": [+ "INT",+ {+ "default": 96,+ "min": 0,+ "max": 2048,+ "tooltip": "裁剪区四周保留的原图上下文像素。普通文字用 96;贴近人体或建筑结构用 256~384。"+ }+ ],+ "max_side": [+ "INT",+ {+ "default": 768,+ "min": 256,+ "max": 2048,+ "step": 32,+ "tooltip": "局部裁剪送入编辑模型的最长边。8GB 显存建议 768;细节复杂且显存足够时用 1024。"+ }+ ],+ "pre_inpaint": [+ [+ "auto",+ "none",+ "telea",+ "ns"+ ]+ ],+ "inpaint_radius": [+ "INT",+ {+ "default": 3,+ "min": 1,+ "max": 15,+ "tooltip": "Telea / NS 预清理的半径,仅作用于遮罩内。色块或贴纸用 3~5;纹理复杂时可关闭预清理。"+ }+ ]+ },+ "optional": {+ "edit_prompt": [+ "STRING",+ {+ "default": "",+ "multiline": true,+ "tooltip": "裁剪节点接收的编辑要求;通常由“02 自动定位 / 手动改框”连线,不需手动填写。"+ }+ ],+ "boxes_json": [+ "STRING",+ {+ "default": "",+ "multiline": true,+ "tooltip": "检测报告 JSON,用于按 overlay_type 选择预清理策略;通常由定位或残留节点连线。"+ }+ ]+ }+ },+ "input_order": {+ "required": [+ "image",+ "mask",+ "context_pixels",+ "max_side",+ "pre_inpaint",+ "inpaint_radius"+ ],+ "optional": [+ "edit_prompt",+ "boxes_json"+ ]+ },+ "is_input_list": false,+ "output": [+ "IMAGE",+ "MASK",+ "QWM_GEOMETRY",+ "STRING",+ "STRING"+ ],+ "output_is_list": [+ false,+ false,+ false,+ false,+ false+ ],+ "output_name": [+ "reference_crop",+ "crop_mask",+ "geometry",+ "status",+ "edit_prompt"+ ],+ "name": "QWMPrepare",+ "display_name": "04 裁剪并记录坐标",+ "description": "",+ "python_module": "custom_nodes.ComfyUI-Qwen-Watermark",+ "category": "Qwen Watermark",+ "output_node": false,+ "has_intermediate_output": false,+ "search_aliases": []+ },+ "QWMRefineMask": {+ "input": {+ "required": {+ "image": [+ "IMAGE"+ ],+ "mask": [+ "MASK"+ ],+ "boxes_json": [+ "STRING",+ {+ "multiline": true+ }+ ],+ "method": [+ [+ "auto",+ "sam",+ "box"+ ]+ ],+ "sam_model": [+ "STRING",+ {+ "default": "sam_vit_b_01ec64.pth",+ "tooltip": "SAM 权重文件名;放在 ComfyUI/models/sams/。"+ }+ ],+ "device": [+ [+ "auto",+ "cpu",+ "cuda"+ ]+ ],+ "dilation": [+ "INT",+ {+ "default": 12,+ "min": 0,+ "max": 64,+ "tooltip": "SAM 或手绘遮罩向外扩的基础像素数,用于覆盖白边、透明边和投影。不规则贴纸开启自适应时会按短边再扩大安全边,最多 64px;它不等于 feather。"+ }+ ],+ "adaptive_dilation": [+ "BOOLEAN",+ {+ "default": true,+ "tooltip": "按大型贴纸短边自动增加外扩,最多 64px。人物、头发或建筑边缘敏感时可关闭。"+ }+ ]+ }+ },+ "input_order": {+ "required": [+ "image",+ "mask",+ "boxes_json",+ "method",+ "sam_model",+ "device",+ "dilation",+ "adaptive_dilation"+ ]+ },+ "is_input_list": false,+ "output": [+ "MASK",+ "IMAGE",+ "STRING"+ ],+ "output_is_list": [+ false,+ false,+ false+ ],+ "output_name": [+ "refined_mask",+ "preview",+ "status"+ ],+ "name": "QWMRefineMask",+ "display_name": "03 不规则轮廓细化(SAM)",+ "description": "",+ "python_module": "custom_nodes.ComfyUI-Qwen-Watermark",+ "category": "Qwen Watermark",+ "output_node": false,+ "has_intermediate_output": false,+ "search_aliases": []+ },+ "QWMResidualDetect": {+ "input": {+ "required": {+ "image": [+ "IMAGE"+ ],+ "clip": [+ "CLIP"+ ],+ "detection_side": [+ "INT",+ {+ "default": 1024,+ "min": 256,+ "max": 2048,+ "step": 32,+ "tooltip": "残留分区送入 Qwen3-VL 的最长边。小残片漏检时提高到 1280;8GB 显存保持 1024。"+ }+ ],+ "expand": [+ "INT",+ {+ "default": 24,+ "min": 0,+ "max": 96,+ "tooltip": "残留候选向外扩的安全边,随后与第一次修复范围取交集。它不会扩大到原遮罩之外。"+ }+ ],+ "max_tokens": [+ "INT",+ {+ "default": 384,+ "min": 64,+ "max": 2048,+ "tooltip": "残留复检 JSON 的最大 token 数。只检查残片,通常 384 足够。"+ }+ ],+ "edit_prompt": [+ "STRING",+ {+ "default": "",+ "multiline": true,+ "tooltip": "二采追加的局部修复要求。只描述残留和需要保持的结构;留空使用自动提示词。"+ }+ ]+ },+ "optional": {+ "allowed_mask": [+ "MASK"+ ],+ "enabled": [+ "BOOLEAN",+ {+ "default": true,+ "tooltip": "是否运行第一次修复后的残留复检。关闭后不会触发二采,最终报告会保留 needs_review。"+ }+ ],+ "first_report": [+ "STRING",+ {+ "default": ""+ }+ ],+ "min_confidence": [+ "FLOAT",+ {+ "default": 0.8,+ "min": 0,+ "max": 1,+ "tooltip": "触发二采的残留置信度阈值。默认 0.8,只处理高置信度残片,避免把自然纹理再次生成。"+ }+ ],+ "original_image": [+ "IMAGE"+ ]+ }+ },+ "input_order": {+ "required": [+ "image",+ "clip",+ "detection_side",+ "expand",+ "max_tokens",+ "edit_prompt"+ ],+ "optional": [+ "allowed_mask",+ "enabled",+ "first_report",+ "min_confidence",+ "original_image"+ ]+ },+ "is_input_list": false,+ "output": [+ "MASK",+ "STRING",+ "IMAGE",+ "STRING"+ ],+ "output_is_list": [+ false,+ false,+ false,+ false+ ],+ "output_name": [+ "residual_mask",+ "boxes_json",+ "preview",+ "edit_prompt"+ ],+ "name": "QWMResidualDetect",+ "display_name": "07 第一次修复后检查残留",+ "description": "",+ "python_module": "custom_nodes.ComfyUI-Qwen-Watermark",+ "category": "Qwen Watermark",+ "output_node": false,+ "has_intermediate_output": false,+ "search_aliases": []+ },"QuadrupleCLIPLoader": {"input": {"required": {