Referenced Image Saver
Re-Save an Image With New Metadata Without Ever Re-Encoding the Pixels
- image_reference
- image_info
- image_reference
- image_info
- file_path
Re-saving an image is usually the point of no return for quality. Every re-encode of a lossy WebP or JPEG makes it worse, and the usual "save image" path goes pixels → decode → re-encode → new pixels, silently degrading the file even though you only wanted to change its metadata. IPT-ReferencedImageSaver does the thing that seems impossible at first: it takes an existing image file (via the image_reference pointer from Image Reader), copies it into your ComfyUI output directory, and rewrites the A1111 infotext metadata from image_info - without touching a single encoded pixel.
This is the node for "I generated this, saved it, and now I want the recipe attached" or "I want to reorganize outputs with correct metadata." The pixels are bit-for-bit preserved; only the metadata block changes.
How it works
It resolves the source file paths from the image_reference input(s), copies each file to the output location, and rewrites the metadata in place. Supported formats are PNG, WebP, and JPEG - all three can carry this kind of text metadata - and the source extension is preserved. Naming works like Image Saver: leave file_stem unconnected and you get automatic serial naming with filename_suffix; connect it and the file saves as <file_stem><source extension>, overwriting any existing file with that name. output_subdir can organize by date (same options as the saver), and write_caption drops a same-name .txt next to each file.
Inputs and outputs that matter
image_reference(required, IPT-ImageFileRef) - the source file pointer, almost always fromImage Reader.image_info(optional) - the metadata to write. This is the whole point; without it you're just copying files.file_stem/filename_suffix- naming, exactly likeImage Saver.write_caption/caption- companion.txtwriting.
Outputs are the updated image_reference, the written image_info (as a list), and file_path.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt
Restart, or ComfyUI Manager → "ComfyUI-Info-Prompt-Toolkit". ComfyUI 0.17.0+. No models.
Common issues
The obvious gotcha: image_reference must come from a node that produces the file pointer (like Image Reader), not a raw image tensor - wire the wrong socket and the node fails on resolution. And because the metadata is rewritten in the copied file, make sure image_info is complete before you save: unlike the pixel path, there's no re-encode to fail on, so an incomplete recipe writes quietly. Overwrite behavior with file_stem is deliberate - connected means clobber, so don't connect it if you need every run to produce a new file. For the "keep the lossy file, fix the metadata" job, this is the right tool and there isn't a stock ComfyUI equivalent.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image_reference | IPT-ImageFileRef | Referenced image file to copy and update without re-encoding pixels | |
| filename_suffix | STRING | image | Suffix part of output filename |
| output_dir | STRING | Base output directory under ComfyUI output | |
| output_subdir | COMBO | none | Output sub directory format |
| write_caption | BOOLEAN | false | Write caption txt file |
| image_infoopt | IPT-IMAGEINFO | Image info or image-info list for each referenced image | |
| file_stemopt | STRING | Optional output filename stem list; when connected, save as <file_stem><source extension> | |
| captionopt | STRING | Caption text or caption list for each referenced image |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image_reference | IPT-ImageFileRef | — |
| image_info | IPT-IMAGEINFO | — |
| file_path | STRING | — |