DataSet_SaveImage
Save a Batch of Images to a Folder, With Names You Control
- Images
ComfyUI's built-in SaveImage dumps everything into output/ with a timestamp-ish name. DataSet_SaveImage lets you pick the folder and the prefix, so every image in a batch comes out as MyPrefix_00000.png, MyPrefix_00001.png, and so on. For assembling a training dataset from generated images - or saving captioning-batch results somewhere specific - that naming control is the difference between "sortable dataset" and "pile of PNGs."
It's a deliberately narrow node: batch of images in, files on disk out. Nothing else. If that's what you need, it's exactly right.
Inputs
- Images - the batch of IMAGE tensors to save. This input is list-aware (
INPUT_IS_LIST), so a multi-image batch is handled image by image. - ImageFilePrefix - the filename prefix, default
Image. Each file becomes{prefix}_{zero-padded-index}.png. - destination - the directory to save into. Created automatically if it doesn't exist, which is genuinely convenient for a workflow that keeps generating fresh output folders.
There are no outputs - it's a terminal output node, so it sits at the end of your graph.
How it works
Under the hood it's PIL + numpy: each tensor is converted back to a uint8 image and saved as PNG. The filename scheme is prefix + a five-digit zero-padded index + .png, always PNG, always a batch index - you don't get to name individual files. That's what DataSet_SaveImagePro is for (it takes a list of explicit names); this one is the quick "dump this batch into this folder" tool.
One nice touch: it embeds PNG metadata - your workflow prompt and extra_pnginfo - unless you've disabled metadata in ComfyUI's settings. So the saved files carry their generation info, which is more than the stock save node does in every case.
Installing
It ships in the ComfyUI-DataSet pack:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-DataSet.git
cd ComfyUI-DataSet && pip install -r requirements.txt
Restart ComfyUI and look under 🔶DATASET🔶. No extra models; it needs nothing beyond what ComfyUI already provides (the pack's heavier requirements are for the Visualizer and chat nodes).
Common issues
Two things to know. First, if the batch contains a (1, H, W, C) tensor - a single image with a leftover batch dimension - the node strips it down before saving, so you won't get weird 1-pixel-tall files. That handling is already built in, but it's worth knowing the node expects proper image tensors, not latents or anything exotic.
Second, all files are PNG with a fixed index numbering, and it will happily overwrite same-named files in the destination. If you re-run a batch into a folder that already has MyPrefix_00000.png, you're replacing it, not skipping it. For a dataset build, pointing each run at a fresh destination folder (or a fresh prefix) is the habit that saves you from silent overwrites.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Images | IMAGE | — | |
| ImageFilePrefix | STRING | Image | — |
| destination | STRING | — |
Outputs (0)
No outputs