WI Save Image
Save Image that names itself after what it tested, and remembers it in the PNG
- images
- iteration_meta
- images
WI Save Image is the Workflow Iterator pack's replacement for ComfyUI's built-in Save Image - a drop-in node with the same images input and pass-through images output, plus two superpowers that make a 30-render batch survivable: filenames that describe the experiment, and metadata embedded in the PNG itself.
The built-in Save Image dumps ComfyUI_00001_.png and on. After a parameter sweep you're looking at a folder of meaningless numbers and guessing which one was CFG 7.5. This node's filename_pattern fixes that with placeholders:
{batch_name}_{index:03d} -> sampler_test_007.png
{batch_name}_{sampler}_{cfg} -> sampler_test_euler_7.5.png
{batch_name}_{index1}_of_{total} -> sampler_test_8_of_30.png
Available placeholders: batch_name, index (0-based), index1 (1-based), total, timestamp, and - the good one - any parameter_name from your sweep, which resolves to the value that produced that image. That's the difference between a folder of serial numbers and a folder you can sort by eye. If a pattern fails to format, it falls back to {batch_name}_{index:03d} rather than crashing, and filename collisions get a _1, _2 suffix appended automatically. The filename is sanitized, so a prompt value with slashes can't go walking up your directory tree.
output_dir (default workflow_iterator) is a subfolder under ComfyUI's output directory, and the optional iteration_meta input - from WI Workflow Iterator - is what makes the metadata magic work.
The metadata that makes the grid possible
On save, the node embeds three things into the PNG's metadata: the standard workflow and prompt JSON (so the file is self-documenting and re-loadable), plus a wi_iteration JSON block recording batch name, batch ID, index, total, mode, and the exact parameter values applied. It also writes an A1111-style parameters string ("Steps: 20, CFG scale: 7.5, Sampler: euler") for the metadata viewers that expect that format. Two practical consequences: your comparison folder is now a research record you can query later, and - more importantly for the pack itself - this node registers each saved image with the batch state manager. The grid compositor reports its own images too, so both nodes count toward batch completion; the compositor just also needs to be in the graph before any grid gets built.
Install and gotchas
Standard pack install: ComfyUI Manager → search "Workflow Iterator", or git clone https://github.com/jason-n-tran/comfyui-workflow-iterator into custom_nodes, then restart ComfyUI. Dependency is only Pillow>=9.0.0. It's a young, small project (v1.0.0, MIT, by Jason Tran) - the kind where the README is still the best docs, and there's a unit-tested core under the hood.
Where people get burned: mostly from expecting the filename pattern to be magic. {cfg} only resolves if a parameter is named cfg and actually got applied - a parameter that failed its title match won't appear in the resolved name, and you'll get a filename with a raw {cfg} or the fallback pattern and no clear error. Same advice as everywhere in this pack: run one render first and check the saved filename before committing to a 100-image batch.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| filename_pattern | STRING | {batch_name}_{index:03d} | — |
| output_dir | STRING | workflow_iterator | — |
| iteration_metaopt | WI_ITERATION_META | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |