Nodes/ComfyUI-NegiTools/Save Image to Directory πŸ§…
ComfyUI Node

Save Image to Directory πŸ§…

Sequential filenames, zero timestamp guessing

By natto-makiΒ·Created 3 years agoΒ·Updated 2 years agoΒ· 31
Save Image to Directory πŸ§…
  • image
  • IMAGE
β—„directory./outputβ–Ί

ComfyUI's built-in Save Image node writes files with timestamp-ish names, which is fine until you want a folder of cleanly numbered outputs you can iterate over in order. That's the gap this node fills: it saves your image to a directory with a sequential out.000001.png-style filename and passes the image through so it can still sit in the middle of a graph.

How it works

Give it a directory (default "./output", resolved relative to your ComfyUI folder) and an image, and it writes the file there. The naming is the useful part: it scans the directory for existing out.??????.png files and picks the next index, so you get out.000001.png, out.000002.png, and so on - no collisions, no overwrites, and the files sort naturally. It saves only the first image in the batch (image[0]), which is worth knowing if you feed it a batch and expect a full set of files; you'll want to handle batching before this node.

The image also comes back out the IMAGE output unchanged, so you can drop this node mid-graph and keep wiring without breaking the flow. That makes it easy to snapshot results at a checkpoint while continuing to process.

Inputs and outputs

  • directory - where to write. Relative paths resolve against your ComfyUI folder, so ./output means ComfyUI/output.
  • image - the image to save (first of the batch).
  • Output: the same IMAGE, passed through.

Where you'd use it

Anywhere you want a stable, ordered set of outputs: batch runs where you want image #17 to be easy to find, chained processing where each stage saves its own numbered snapshot, or a folder you intend to feed back into another tool. It's the kind of node that's trivial on its face and quietly essential once you're doing systematic runs.

Installing it

It's in the ComfyUI-NegiTools pack. Install via ComfyUI Manager (search "ComfyUI-NegiTools") or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/natto-maki/ComfyUI-NegiTools
pip install -r ComfyUI-NegiTools/requirements.txt

then restart. No API key, no model downloads, no runtime cloning - it's pure PIL, so this is one of the pack's lightest nodes even though it shares the heavy requirements.txt.

One thing to know

The directory gets created automatically if it doesn't exist, which is convenient but means a typo in the path silently spins up a new folder somewhere unexpected. And remember the "first image only" behavior - if you're saving batches, put a batching node before this one or you'll only ever see the first frame of each run.

Categoryutils

Inputs (2)

NameTypeDefaultDescription
directorySTRING./outputβ€”
imageIMAGEβ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”