ComfyUI Node

Image Saver

The save node that writes the A1111 metadata CivitAI actually wants

By tsukino4a·Created 2 months ago·Updated 15 days ago· 24
Image Saver
  • images
  • hashes
  • a1111_params
filename%time_%seed
path
extension
lossless_webptrue
quality_jpeg_or_webp100
optimize_pngfalse
embed_workflowfalse
save_workflow_as_jsonfalse
model_name
loaded_loras
prompt_json
positive
negative
parameters_json
custom
counter0
time_format%Y-%m-%d-%H%M%S
show_previewtrue

ComfyUI's built-in SaveImage embeds the workflow graph, which is great for rebuilding a canvas but not what CivitAI's uploader keys on when it auto-links your model and LoRAs. That auto-linking wants a flat, A1111-style parameters string plus resource hashes. This node writes both - and it does it from the actual parameters your workflow ran, not a guess. If you post generations anywhere that parses metadata, this is the output node you want at the end of the pipe.

Where it comes from

It's an adaptation of alexopus's ComfyUI-Image-Saver (a name with a real footprint in the community - people swap it in specifically for CivitAI uploads), reworked to fit this pack. The file-naming and raster/EXIF behavior are lifted from that project under MIT; the metadata side is the pack's own, schema-tagged so it can round-trip with the rest of the 4A nodes.

How it works

Give it images and it writes PNG, JPEG, or WebP into a subfolder of ComfyUI's output/ directory. The interesting part is what it records alongside the pixels:

  • Exact generation parameters. Connect the pack's Input Parameters / Double Sample Parameters parameters_json (or a scheduler's prompt_json) and it extracts seed, steps, sampler, CFG, size, denoise from those schema-tagged blobs and writes them into A1111-compatible metadata (Steps:, Sampler:, CFG scale:, Seed:, Size:, Denoising strength:).
  • Resource hashes. Give it model_name and it resolves the file's SHA256 automatically (by name match across checkpoint/UNet folders); give it Lora Manager's loaded_loras output and it hashes the active LoRAs; embedding hashes too. Hashes are computed once and cached by file size + mtime, and a .sha256 sidecar next to a model is reused instead of re-hashing. These land in the hashes output and inside the metadata - the exact payload CivitAI's auto-detection wants.
  • The workflow chunk. embed_workflow is on by default, so dragging the saved PNG back into ComfyUI still rebuilds the graph. Unlike the flat-parameters-only savers, you get both dialects.

Inputs that matter

  • images (IMAGE) - the required one, straight from VAE Decode.
  • filename - defaults to %time_%seed, using the same variables as Image Saver Simple (%time, %seed, %counter<N> with zero-padding, custom %time_format<...>). Good default; you'll usually leave it.
  • path - subfolder under output/; blank saves to the root.
  • extension (png/jpeg/jpg/webp) and the format controls (lossless_webp, quality_jpeg_or_webp, optimize_png).
  • prompt_json - wire the Prompt Scheduler's prompt_json here and prompts come along automatically. If it's not connected, positive / negative fall back to direct entries.
  • parameters_json - concatenated Input + Double Sample JSON from the two parameter nodes.
  • custom - arbitrary text appended to the A1111 metadata.
  • show_preview - on by default; flip it off for headless runs.

Outputs: hashes (resolved model/LoRA/embedding hashes as a string) and a1111_params (the parameter string written into the image). Both handy if you want to log or reuse them.

Installing it

Ships with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/tsukino4a/ComfyUI-4A-Prompt-Manager.git
cd ComfyUI-4A-Prompt-Manager
python install.py   # or: pip install -r requirements.txt

Restart after. ComfyUI Manager users: search 4A Prompt Manager. Note the one real dependency: piexif (in requirements.txt) is required for JPEG/WebP metadata. PNG works without it.

Troubleshooting

  • JPEG/WebP save errors - that's piexif missing. pip install piexif or re-run install.py. PNG is unaffected.
  • No model hash in the metadata - the node needs model_name connected (or resolvable) to hash the checkpoint; it can't infer a hash from nothing.
  • LoRA hashes absent - loaded_loras comes from willmiao's Lora Manager node's loaded_loras output. Without Lora Manager installed, LoRA info simply won't be there.
  • First save is slow - hashing a multi-GB checkpoint takes a moment; subsequent runs hit the cache.
Category4A-Prompt-Manager

Inputs (19)

NameTypeDefaultDescription
imagesIMAGEimage(s) to save
filenameSTRING%time_%seedSame filename variables as Image Saver Simple
pathSTRINGpath under ComfyUI's output directory
extensionCOMBO4 options: png, jpeg, jpg, webp
lossless_webpBOOLEANtrue
quality_jpeg_or_webpINT1001–100
optimize_pngBOOLEANfalse
embed_workflowBOOLEANfalse
save_workflow_as_jsonBOOLEANfalse
model_nameoptSTRINGcheckpoint or UNet filename; its SHA256 is resolved automatically
loaded_lorasoptSTRINGLora Manager loaded_loras output
prompt_jsonoptSTRINGPrompt Scheduler prompt_json
positiveoptSTRINGPositive prompt when Prompt Scheduler is not connected; ignored when prompt_json provides prompts
negativeoptSTRINGNegative prompt when Prompt Scheduler is not connected; ignored when prompt_json provides prompts
parameters_jsonoptSTRINGConcatenated Input Parameters and Double Sample Parameters JSON
customoptSTRINGcustom text appended to A1111 metadata
counteroptINT00–18446744073709550000
time_formatoptSTRING%Y-%m-%d-%H%M%S
show_previewoptBOOLEANtrue

Outputs (2)

NameTypeDescription
hashesSTRINGResolved model, LoRA and embedding hashes
a1111_paramsSTRINGA1111-compatible parameters written to the image