Nodes/ComfyUI-ZSNodes/Save Image (ZS Custom)
ComfyUI Node

Save Image (ZS Custom)

Save images at the filename you actually asked for

By ZeroSpaceStudios·Created about a year ago·Updated about a year ago· 0
Save Image (ZS Custom)
  • images
  • filename
filename_prefixComfyUI
output_folderoutput
caption
caption_file_extension.txt

The default ComfyUI Save Image node never saves where you think. Give it a filename_prefix of "my_image" and you get something like my_image_00001_.png - auto-incremented counters and batch numbers bolted on whether you want them or not. That's great when you're hoarding every render, and maddening when a script, a dataset pipeline, or another tool is sitting there expecting a file named exactly my_image.png.

ZS_SaveImage is that annoyance in reverse. It uses your filename_prefix verbatim as the filename. One image in → my_image.png. A batch of three → my_image_000.png, _001, _002. No persistent counter, no prefix mangling across runs. That predictability is the whole point: it's built for automation where filenames are part of the contract, not for keeping a numbered archive of drafts.

How it works. Looking at the source, a single image saves as {prefix}.png; only when the batch holds more than one image does it append the _NNN suffix. The good news: it still embeds ComfyUI's prompt and workflow metadata as PNG text chunks, so your workflow stays recoverable from the file (metadata is only skipped if you launched ComfyUI with --disable-metadata). Feed the caption input and it writes a .txt file with that text next to the image - handy for captioning batches as you export.

Inputs:

  • images - the tensor(s) to save.
  • filename_prefix (default "ComfyUI") - used directly as the filename, no auto-increment.
  • output_folder (default "output") - relative paths land inside ComfyUI's output directory; absolute paths are used as-is.
  • caption (optional) and caption_file_extension (default ".txt") - the caption text file.

Output: filename, a STRING with the name of the last file saved - wire it to a text node if something downstream needs to know what got written.

Gotchas worth knowing:

  • Watch that default output_folder. Leave it at "output" and your files land in ComfyUI/output/output/. Give it a relative path you actually mean, or an absolute one.
  • The README says batch numbering starts at _001; the code actually starts at _000. Don't build a script around the README's claim.
  • The filename output only returns the last file in a batch, so if you need every name, save one image per run or read the folder yourself.
  • The caption file is only written when the caption input is actually connected - an empty-but-connected caption writes an empty .txt.

Install. Same pack as the Bounding Box Crop node - ComfyUI Manager (search "ComfyUI-ZSNodes"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/ZeroSpaceStudios/ComfyUI-ZSNodes
pip install -r requirements.txt

Restart ComfyUI. Unlike its sibling, this node needs nothing heavier than Pillow and numpy, which ComfyUI already ships - no model downloads, no GroundingDINO. The README is explicit that if the heavy dependency ever fails to install, this node keeps working; the two halves of the pack don't share fate. It's the cheap, safe reason to install this pack.

Categoryzsnodes/image

Inputs (5)

NameTypeDefaultDescription
imagesIMAGEThe images to save.
filename_prefixSTRINGComfyUIUsed directly as filename (without automatic counter/batch number)
output_folderSTRINGoutputThe folder to save the images to.
captionoptSTRINGString to save as .txt file alongside the image
caption_file_extensionoptSTRING.txtThe extension for the caption file.

Outputs (1)

NameTypeDescription
filenameSTRING