Save Image With Metadata
The saver that stuffs your prompt, workflow and notes into the file
- images
- file_paths
ComfyUI's default Save Image already embeds the prompt and workflow into PNGs, so why would you want another saver? Because the default one gives you almost no control: fixed filename pattern, fixed output folder, PNG only. XJSaveImageWithMetadata is the version for people who actually care about their archive - it's the author's take on WAS Node Suite's famous image saver, with filename tokens, six output formats, custom metadata, and full control over numbering.
The README is upfront that the pack is "primarily for personal use," but this is one of the nodes where that personal itch produced something broadly useful. If you save images to organize, re-find, and re-load them, this is the node in the pack you'll keep coming back to.
How it works
On save, it writes the image with embedded metadata: PNG/TIFF/BMP get their prompt and workflow in PNG text chunks, WebP tucks it into EXIF, and any custom string you feed into the metadata input goes into a dedicated xj_metadata key (PNG) or EXIF UserComment (JPEG/WebP). That custom key is what the pack's Load Image With Metadata node knows how to pull back out - the pair is a proper round-trip.
The filename machinery is the fun part. Beyond the usual counter, it supports tokens in filename_prefix and output_path: [time], [time(%Y-%m-%d)], [hostname], [user], [cuda_device], [cuda_name]. So [time(%Y%m%d)]/[user]_[cuda_name] gives you organized, self-describing folders like 20260816/gabe_rtx4090_00001.png. There's also a choice of three filename orders, and overwrite_existing off means it always finds the next free number rather than clobbering.
The inputs that matter
There are a lot of knobs; a beginner only needs a few:
images- theIMAGEbatch to save.filename_prefix- base name (tokens allowed). DefaultComfyUI.extension-png,jpg,jpeg,webp,bmp, ortiff. PNG is the metadata-safe default.qualityanddpi- for lossy formats and print/archive metadata.metadata(optional) - a free-form string to embed alongside the workflow.
The two modes are worth a mention: filename_mode swaps between prefix_number (ComfyUI_00001.png), number_prefix, and number_only (a single global counter shared across prefixes, handy for one giant sequential archive). Optional toggles: embed_workflow (on by default), optimize, lossless_webp.
Output is a single file_paths output - a list of the full paths of everything it wrote, so a downstream node or log can reference them. It's an output node (the is_output_node flag is true), so it also shows its saves in the UI.
Installing it
Part of ComfyUI-XJNodes, installed once:
cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes
then restart ComfyUI, or search ComfyUI-XJNodes in ComfyUI Manager. No models, no extra dependencies beyond ComfyUI's own Pillow/torch stack.
Common issues
JPEG is the trap: it has no PNG text chunks, so your prompt/workflow metadata goes in EXIF, and JPEG conversion also forces RGB (no alpha). If you need lossless round-trips, stick with PNG. And number_only mode scans the folder for existing numbered files to compute the next counter - if you mix prefixes and formats in the same directory, the scan can pick up files this node didn't write. That's a quirk, not a bug; keep archives tidy and it behaves.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| output_path | STRING | — | |
| filename_prefix | STRING | ComfyUI | — |
| number_padding | INT | 51–10 | — |
| filename_delimiter | STRING | _ | — |
| filename_mode | COMBO | prefix_number | 3 options: prefix_number, number_prefix, number_only |
| extension | COMBO | 6 options: png, jpg, jpeg, webp, bmp, tiff | |
| quality | INT | 1001–100 | — |
| dpi | INT | 30072–2400 | — |
| overwrite_existing | BOOLEAN | false | — |
| optimizeopt | BOOLEAN | false | — |
| lossless_webpopt | BOOLEAN | false | — |
| embed_workflowopt | BOOLEAN | true | — |
| metadataopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_paths | STRING | — |