Save Image And Prompt (exact)
Save an image and prompt to an exact, known filename
- image
- alpha
Its sibling in this pack, SaveImageAndPromptIncremental, picks the next free filename so you never collide. This one goes the opposite direction: you tell it the exact path, it writes the image there, and drops the prompt in a matching .txt beside it. No counters, no scanning, no guessing - the filename you type is the filename you get.
That determinism is exactly what some things need. If you're driving an external pipeline, a render farm, or a watcher that looks for a specific file at a specific path, "the node picked a name" doesn't cut it. You want this file at this path, every run.
How it works
The author's tooltip is the spec: "The exact filepath to write the image to. Extension should be either .png or .exr, caption will be written to .txt." So you supply filepath and it writes two files - <name>.png (or .exr) plus <name>.txt containing whatever prompt you feed it.
A few behaviors worth knowing, straight from the code:
- PNG or EXR only. If you type
.jpgor.jpeg, it silently rewrites the path to.png. It's not going to fight you, but it's also not going to give you a JPEG. - 16-bit PNG is a toggle.
png_16bit(default off) switches from 8-bit to 16-bit output. The float EXR path converts to linear first, so you get real float data instead of display-encoded. - Optional
alphagets appended as a fourth channel when you save PNG or EXR with transparency.
Optional inputs are image, alpha, and prompt - and the node requires at least one of image or prompt, so you can't save nothing. The prompt input has defaultInput: true, meaning if you leave it unwired it'll grab the workflow's prompt text automatically.
The trap: batches
Here's the one that'll bite you. The node writes only the first image in the batch. If you feed it a 30-frame batch expecting 30 files, you get one. The code grabs image[0] and moves on. SaveImageAndPromptIncremental loops over the whole batch; this node is explicitly a single-image writer. For a batch, use the incremental one or SaveEXRFrames.
And "exact" cuts both ways: it will happily write over an existing file at that path. There's no overwrite guard here (unlike the EXR save nodes, which refuse to clobber). If determinism is the point, a stale file at that path is now gone.
Install
Part of spacepxl's ComfyUI-HQ-Image-Save: ComfyUI Manager → search ComfyUI-HQ-Image-Save → install → restart, or git clone https://github.com/spacepxl/ComfyUI-HQ-Image-Save into custom_nodes/. Dependencies are imageio and opencv-python, no models.
When to reach for it
Exact path, single image, prompt sidecar, deterministic - that's a tooling or automation use case. If you're hand-building a dataset or just saving outputs, the incremental sibling is friendlier. If a script or another app is waiting on a specific filename, this is the node. Read the pairs back with LoadImageAndPrompt and the loop closes.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| filepath | STRING | absolute filepath | The exact filepath to write the image to. Extension should be either .png or .exr, caption will be written to .txt |
| png_16bit | BOOLEAN | false | — |
| imageopt | IMAGE | — | |
| alphaopt | MASK | — | |
| promptopt | STRING | — |
Outputs (0)
No outputs