Nodes/CMK Flow/CMK Mask Detailer · Intake
ComfyUI Node

CMK Mask Detailer · Intake

CMK's Mask Detailer Intake

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK Mask Detailer · Intake
  • PROCESS
  • IMAGE
  • LOG
  • PROCESS
  • IMAGE
  • LOG
  • MASK DETAILER SOURCE
  • READY
◄capture_currentfalse►
◄image▾►

Here is a genuinely annoying thing about ComfyUI: you get a render you like, you want to fix one hand or one ear by hand, and the moment you rerun anything upstream your working image is gone. Your mask survives. The image it was painted on does not. You now have a mask of a picture that no longer exists.

CMK Mask Detailer · Intake exists to kill that. It takes the finished image out of a CMK chain, locks it as a local snapshot, and then deliberately severs itself from the upstream execution. The pack's own English copy calls it a "terminal intervention gate: a new Flow run replaces neither the working image nor its mask."

How it works

The node writes a snapshot into input/ plus a small sidecar JSON holding a pixel fingerprint and the upstream process metadata. After the first capture, it compares the incoming IMAGE against that locked fingerprint.

  • Fingerprint matches and a mask exists → status LOCKED, and it hands you the snapshot plus your painted mask.
  • Fingerprint matches but the mask is empty → LOCKED · PAINT MASK; it waits for you.
  • Fingerprint differs, or nothing is locked → LIVE · CAPTURE CURRENT; the incoming frame is stored as a candidate, never as the working image.

That last distinction matters. A fresh upstream run drops a pending candidate, but it does not overwrite your locked snapshot or mask. Only flipping capture_current to true starts a new mask session, and it raises an error rather than silently doing nothing if no candidate is waiting.

Inputs and outputs

The four required inputs are PROCESS, IMAGE, LOG, and capture_current (default false). All three wires are lazy - if capture_current is true, the node doesn't bother evaluating upstream at all, which is why the freeze actually holds.

There is also a hidden-in-plain-sight optional widget: image, labelled LOCKED IMAGE, a dropdown of every .png under input/. Both the plain name and the name [input] spelling appear, because that is how ComfyUI's mask editor persists painted files. You normally leave it alone and let the mask editor fill it.

Outputs: PROCESS, IMAGE, LOG, MASK DETAILER SOURCE (a CMK_MASK_DETAILER_SOURCE terminal token) and READY (a boolean). READY is the interesting one - it flips true only when a locked snapshot and a non-empty mask both exist, and it is what tells CMK Mask Detailer Flow Gate to route the active branch instead of the bypass branch.

Wiring it up

Chain it to CMK Mask Detailer · Prepare, which wants the MASK DETAILER SOURCE token, the image and the log. Prepare then builds the process and CMK Mask Detailer · Process does the actual masked re-render. If you'd rather stay inside a Flow workflow, the gate handles the switch between "detail this" and "just pass the image through" for you.

Practically: paint the mask with ComfyUI's own mask editor, not a third-party tool. The fingerprinting, the [input] naming and the lock semantics are all built around what ComfyUI's editor writes.

Install

Standard for the pack. Manager → search CMK Flow → install from CMKFlow → restart. Manual route, ComfyUI closed first:

git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py

Look for CMK dependency check: OK. Required libraries include ultralytics, onnxruntime, insightface, segment-anything, nudenet and opencv-python - a fat dependency set for the pack as a whole, though this particular node just needs torch and PIL.

Traps

It is not a batch node. The lock is per-node-instance, keyed on the image fingerprint of a single frame. Feeding it a 16-image batch gives you a snapshot of one, because intake takes IMAGE[0:1].

Snapshots are real files. They land in your ComfyUI input/ directory and they persist. That is the feature. It also means a workflow rebuilt on another machine has a dangling LOCKED IMAGE reference, and you'll see LIVE · CAPTURE CURRENT again on first run. Expected, not broken.

Caches live under ComfyUI/temp/cmk/ and are wiped on restart. The Intake snapshot is not one of those - it's an input file, and it survives. That's the difference between this node and everything else in the flow.

CategoryCMK/Flow/Mask Detailer

Inputs (5)

NameTypeDefaultDescription
PROCESS*—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
capture_currentBOOLEANfalse—
imageoptCOMBO3 options: None, example.png, example.png [input]

Outputs (5)

NameTypeDescription
PROCESS*—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
MASK DETAILER SOURCECMK_MASK_DETAILER_SOURCE—
READYBOOLEAN—