Nodes/ComfyUI-HeresyNodes/⛧Save Latent And Images
ComfyUI Node

⛧Save Latent And Images

Save a Wan latent plus every section's frames in one go, skipping what's done

By heresyCoder·Created 3 months ago·Updated 3 months ago· 2
⛧Save Latent And Images
  • latent
  • img_dict
  • any
  • save_log
  • any
project_subpath
folders_str
latent_filename
latents_subfolder
images_subfolder

This is the orchestrator of the whole pack. Chunked Wan workflows produce two things per section that you need to keep: the video latent (so you can continue from it later) and the decoded frames (so you can see, stitch, or upscale them). Save Latent And Images takes both - one latent plus a dictionary of per-section image batches - and writes them into a tidy numbered-folder tree in one pass, skipping any section that's already on disk.

It's the write-side counterpart to Load Image Folders, and together they give you a restartable loop: render a section, save it here; on a later run, the node sees the section's folder already exists and leaves it alone, so you only ever fill in the gaps.

The inputs

  • latent - the Wan video latent tensor to save (the whole clip, not per-section).
  • img_dict - a DICT mapping keys like 01 to image batches. One batch per section.
  • project_subpath - where things go under your output folder, e.g. my_renders. Path traversal is scrubbed (.. becomes _).
  • folders_str - newline-separated names of folders that already exist. Any key whose folder (or its _L twin) is listed here gets skipped. This is where Get Subfolders feeds in.
  • latent_filename - filename (no extension) for the saved latent.
  • latents_subfolder - subfolder name inside each section for the .safetensors.
  • images_subfolder - subfolder name inside each section for the frame batch.
  • any - optional pass-through for chaining.

Outputs are save_log (a multiline string reporting what was saved and what was skipped) and any (the pass-through).

The layout it writes

For each dict key, the node creates a section folder named <key>_L - the _L marks it as latent-bearing, which is the same convention Delete Numbered Folders cleans up. Inside it:

my_renders/01_L/latents/my_render.safetensors
my_renders/01_L/images/i_00001_.png, i_00002_, ...

The latent goes through the pack's Wan latent saver (safetensors format, all tensors preserved); the frames go through Save Image Batch (For Loops) with metadata off, which is why this is the natural place to let intermediate PNGs be small. A key is skipped if either <key> or <key>_L already exists in folders_str - the _L tolerance means it recognizes a section regardless of which save convention a previous run used.

Install

It's the centerpiece of ComfyUI-HeresyNodes, heresyCoder's small personal pack:

cd ComfyUI/custom_nodes
git clone https://github.com/heresyCoder/ComfyUI-HeresyNodes

Restart ComfyUI, or install via Manager ("ComfyUI-HeresyNodes"). No models to download; the only soft dependency anywhere in the pack is kornia for one blend mode on the stitch node.

The honest take

This node is only useful if your workflow already organizes output as numbered sections with a dict of image batches - which is exactly the pattern this pack is built around, so within that world it's the glue. The resume behavior is the feature: point folders_str at reality (via Get Subfolders) and a crashed or interrupted run just continues where it stopped, instead of re-rendering and overwriting everything. Two things to respect: img_dict keys must line up with the two-digit folder scheme (or everything gets dumped under one _L folder), and because the frames are written without embedded workflow metadata, the per-section PNGs won't reconstruct the graph if you drag them back - keep the latent for that. The save_log output reads like a little receipt; wire it to Show Text if you want to see what a run actually did.

Category⛧Heresy Nodes/utils

Inputs (8)

NameTypeDefaultDescription
latentLATENTWan video latent tensor
img_dictDICTDictionary mapping keys (e.g., '01') to image batches
project_subpathSTRINGSubpath in the output folder
folders_strSTRINGNewline separated string of existing folders
latent_filenameSTRINGFilename without extension for the latent
latents_subfolderSTRINGSubfolder name for the safetensor
images_subfolderSTRINGSubfolder name for the image batch
anyopt*For chaining

Outputs (2)

NameTypeDescription
save_logSTRING
any*