Nodes/CMK Flow/CMK Z-Image Turbo Finalize -Pipe-
ComfyUI Node

CMK Z-Image Turbo Finalize -Pipe-

The decode step that turns a latent back into an image

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK Z-Image Turbo Finalize -Pipe-
  • MODEL
  • PROCESS
  • SAMPLED
  • LOG
  • MODEL
  • PROCESS
  • IMAGE
  • LOG
  • diagnostic

Between the ZIT sampler and the post-process zone there's a decode - somebody has to turn the sampled latent into RGB. CMK Z-Image Turbo Finalize -Pipe- is that somebody. It takes the model context, the ZIT process pipe and the sampled latent, and hands back an IMAGE plus the pipes rejoined, ready for the family-neutral detailers, face passes and upscalers.

It sits in CMK/Developer/Pipe/Finalize. If you're building against CMK rather than running a shipped workflow, this is one of the nodes you'll wire by hand, and it's the natural place to understand why the pack uses a separate transport type for latents.

How it works

CMK's ZIT path doesn't move latents as ComfyUI's LATENT. It uses a proprietary SAMPLED pipe, which is what carries the sampler's output through the instantaneous handoffs inside the generation section. Finalize is the boundary where that proprietary type ends and a plain IMAGE begins.

Three things happen:

  1. It pulls the VAE off the model pipe and the latent out of SAMPLED - trying samples, then latent_1st_pass, then latent_image, which is how it copes with first-pass versus refiner-style latents.
  2. It decodes. If SAMPLED already carries an image (the inpaint paths composite one), it uses that; otherwise it calls ComfyUI core's VAEDecode with the pipe's VAE. If that returns nothing it raises rather than passing a None image downstream, and the message names the node so you know where you are.
  3. It composites for masked finishes. In the inpaint modes the sampled payload carries the unfilled source image and the authoritative finish mask, and Finalize blends the decoded result back over the source. HYBRID inpaint and direct ZIT inpaint take the same path; if the handoff image or mask is missing you get an explicit "lost the ... handoff image" error instead of a subtly wrong picture.

The family guard is the other half. Both the lazy check and the run begin by looking at PROCESS["family_active"]. If the ZIT family isn't the live one, the node returns an ExecutionBlocker for its image-bearing outputs and passes the process pipe through - so a ZIT branch sitting unused in a HYBRID or SDXL run costs nothing and produces no stray image. That's the same pattern the pack's loader and ControlNet nodes use, and it's what lets three families coexist in one graph without a manual switch.

Inputs and outputs

Required:

  • MODEL (CMK_MODEL_PIPE) - must contain a vae. Missing VAE is an explicit error, not a fallback.
  • PROCESS (CMK_PROCESS_Z_IMAGE) - the ZIT process context.
  • SAMPLED (CMK_SAMPLED_PIPE) - the sampler's output.

Optional: LOG (CMK_LOG_PIPE) - documentary.

Outputs: MODEL, PROCESS (CMK_PROCESS_Z_IMAGE), IMAGE, LOG, diagnostic. Wire IMAGE into the post-process boundary, and carry MODEL and PROCESS onward so downstream modules know which family they're finishing.

MODEL, SAMPLED and LOG are lazy, so on a run where the family is inactive the node never asks for them.

Install

CMK/Developer/Pipe/Finalize - it comes with the pack. Manager → search CMK Flow → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/CMKFlow/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py
python3 custom_nodes/cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/shared/models"

The ae.safetensors VAE the ZIT path uses must be visible to ComfyUI in models/vae - the resource checker names it specifically, which is better than discovering it at decode time.

Common issues

  • "requires MODEL['vae'] and a sampled latent." Your model pipe didn't come from the ZIT loader, or it was evicted. Re-run through CMK Z-Image Turbo Loader -Pipe-.
  • Latent in, blocked out, nothing downstream. family_active was false for ZIT - a HYBRID run that ended on the SDXL branch, or a family switch. Working as designed.
  • An inpaint run reports a lost handoff image or mask. The compositing metadata didn't survive into the sampled payload, usually because the inpaint section was rebuilt or partially bypassed. Rebuild the module rather than patching the mask input.
  • Blurry or washed-out output with no error. That's a decode-side symptom of the wrong VAE or a model loaded in a mismatched dtype; check the loader's log lines before blaming this node.
CategoryCMK/Flow/Sampling

Inputs (4)

NameTypeDefaultDescription
MODELCMK_MODEL_PIPE—
PROCESSCMK_PROCESS_Z_IMAGE—
SAMPLEDCMK_SAMPLED_PIPE—
LOGoptCMK_LOG_PIPE—

Outputs (5)

NameTypeDescription
MODELCMK_MODEL_PIPE—
PROCESSCMK_PROCESS_Z_IMAGE—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
diagnosticCMK_DIAGNOSTIC—