Save Image Batch With Filenames (Soze)
Save a Whole Image Batch With Per-Image Names — Dataset Assembly Without a Script
- images
- saved_paths
- count
- status
ComfyUI's stock Save Image node names files with a counter and calls it a day. That's fine for casual output and genuinely useless when you're building a dataset, a training batch, or a set of images you need to match by name to some other file. Save Image Batch With Filenames exists for the second case: you hand it an IMAGE batch and a parallel list of filenames, and each image is saved under its own name, into its own subdirectory if you want, with a format you control.
The pairing is by index - image 0 gets filename 0, image 1 gets filename 1, and so on. The filenames input accepts either a JSON array (["a.png", "b.png"]) or a plain newline-separated list, so it plays nicely with a JSON node, a CSV reader, or a hand-typed block. Subdirectories inside a filename are honored: name one scenes/day01.png and the node creates scenes/ for you. If your list is shorter than the batch, the extras get auto-generated image_N.png names; if it's longer, the trailing names are ignored and logged. Both edges are handled, which is rarer than it should be.
The inputs that matter
images- the batch to save. The node explicitly handles upstream nodes that deliver a Python list of tensors (theOUTPUT_IS_LISTcase), which used to crash batch savers - so this one is robust where its predecessors blew up.filenames- JSON array or newline list, one per image.output_path- directory to save into. Empty = the output dir root; a relative path is resolved under the output dir; an absolute path is used as-is. That last one is handy when you're building a training folder somewhere on your disk.overwrite- off by default: on a name collision it appends the standard ComfyUI_NNNNNcounter and keeps both files. On, it overwrites in place. For dataset building where you want idempotent re-runs, flip this on.default_format-png,jpeg, orwebp, used only when a filename has no extension.jpeg_quality(default 95) applies to jpeg/webp.
Outputs: saved_paths (the full paths that were actually written, handy to feed into a file-list node), count, and status.
Where it shines
Building a training pair is the headline use: generate a batch of variants, name each one to match its conditioning or its source image, and the folder is ready for a dataset tool or a LoRA training run with zero renaming chore. It's also the right node when you're saving a batch of face crops, character sheets, or any "this batch has a natural naming scheme" output. The output path handling makes it the difference between fighting your folder structure and just declaring it.
Install & gotchas
cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt
No keys, no models. Two things to watch: filename counts and the overwrite toggle. A batch with twenty frames and a five-name list silently auto-names fifteen of them - check status if your output folder looks wrong. And remember the counter behavior is your collision protection; if you turn on overwrite thinking it makes runs faster, that's exactly the setting that will clobber a previous run's files if your names aren't unique.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Batch of images to save. | |
| filenames | STRING | JSON array or newline-separated filenames, one per image. Subdirectories inside a filename are honored. | |
| output_path | STRING | Directory to save into. Relative to ComfyUI output dir, or absolute. Empty = output dir root. | |
| overwrite | BOOLEAN | false | On: overwrite existing files. Off: append the standard ComfyUI _NNNNN counter on collision. |
| default_format | COMBO | png | Format used when a filename has no extension. |
| jpeg_qualityopt | INT | 951–100 | Only used for jpeg / webp. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| saved_paths | STRING | — |
| count | INT | — |
| status | STRING | — |