Save Image To Folder
Batch exports with filenames that don't clobber each other
- images
The FairLab Save Image To Folder node exports an image batch to a folder of your choice, using a filename pattern with {time} and {batch_num} placeholders. It's the batch-safe sibling of Save Image To Directory - the one you reach for when the graph is producing many images and each one needs its own filename instead of silently overwriting the last.
Where Save Image To Directory gives you exact single-file control, this one gives you the conveyor belt: drop a batch in, get a folder of uniquely-named PNGs out, timestamped and indexed. If you've ever watched five generations collapse into one file because you used the wrong save node, you'll appreciate this.
How it works
For every image in the batch, the node:
- Replaces
{time}in the pattern with aYYYY-MM-DD-HH-MM-SStimestamp. - Replaces
{batch_num}with the image's index in the batch (0, 1, 2…). - Saves the result as a
.pnginfolder_path.
The default pattern is ComfyUI_{time}_{batch_num}, which gives you collision-free names across runs and within a run. It also handles grayscale frames by converting them to RGB before writing - a small robustness touch.
The inputs that matter
- images - the batch to export.
- folder_path - destination, defaulting to
~/Desktop. (That's the author's default; you'll almost certainly change it.) - filename_prefix - the pattern.
{time}and{batch_num}are the only two placeholders it understands.
No outputs - it's a terminal node. Files appear, graph is done.
What's worth knowing
- The placeholders are the whole game. Anything else in the pattern is literal text. If you want your own counter or a seed in the name, you'll need to assemble it elsewhere - this node won't do
{seed}. - Always PNG. There's no format toggle; lossless, no
compress_levelknob. If you need JPG output or compression control, that's Save Image To Directory. - It won't create the folder. Same rule as the rest of the pack's I/O nodes - missing directory, runtime error. Check the path before you queue.
- No embedded workflow metadata, same as its sibling - plain PIL saves, not the ComfyUI metadata path. Fine for exports, wrong tool if the point is "share a workflow-included image."
When you'd use it
- Exporting a batch of generations for review or delivery.
- Writing frames out of a video or image-to-video pipeline as numbered PNGs.
- Producing a folder of variants where every file must be distinct and findable later.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart, or search "ComfyUI-FairLab" in ComfyUI Manager. PIL comes with ComfyUI, so no extra dependency for this node - but run the pack's full requirements anyway; the video and translate nodes need them.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| folder_path | STRING | /root/Desktop | — |
| filename_prefix | STRING | ComfyUI_{time}_{batch_num} | — |
Outputs (0)
No outputs