Save Image To Directory
Put your output exactly where you want it, not in the default pile
- image
ComfyUI's core Save Image node is a good citizen of the ecosystem, but it has exactly one destination: the output folder, with a timestamped name you don't control. The FairLab Save Image To Directory node exists for the moment you need the image in a specific folder with a specific name, in a format you choose - the dataset export, the client drop, the "this has to land at /data/render/hero_shot.png or the pipeline breaks" moment.
The README categorizes it under image I/O, and that's the right frame: it's an export valve, not a preview. You pick the directory, the filename, the format, and the compression, and the batch gets written there.
How it works
The node iterates over every image in the batch and writes each frame with PIL. The two format options are:
- png - lossless, with a
compress_levelknob (0–9, default 4). - jpg - lossy, for size-conscious output.
The compress_level input (an integer 0–9) is the PNG compression setting from the PIL save call. Lower = bigger file, faster write; higher = smaller file, slower write. The default of 4 is a sane middle ground - you rarely need to touch it.
The inputs that matter
- image - the batch to save.
- directory - the destination folder.
- name - the filename, no extension (the node appends
.pngor.jpg). - type -
pngorjpg. - compress_level - 0–9, default 4.
It's an output node: no sockets out, just files on disk.
The gotcha that will bite you
Read the loop carefully and you'll spot it: every image in the batch is written to the same filename. The name is applied per-frame, so a batch of five images all try to write name.png, and each save overwrites the previous one. You end up with one file - the last frame in the batch.
That's fine for a single image, which is the most common use. For a batch, it's a silent data-loss trap. If you're saving multiple frames, use Save Image To Folder instead - it numbers files per batch index with its {batch_num} pattern, which is the right tool for the multi-image job.
Two more things:
- It won't create the directory. Missing folder → runtime error.
- No workflow metadata. This writes pixels via PIL, not the ComfyUI save path, so the PNG won't carry the embedded workflow graph the way core Save Image does. The KB's image-io doc spells out why that matters: for sharing workflow-included images, keep core Save Image in the graph; use this one for exports where you don't need the graph baggage.
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. Saving uses PIL, which ComfyUI already ships, so there's no extra dependency for this node - but the pack as a whole pulls opencv-python and friends, so do the full requirements install regardless.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| directory | STRING | — | |
| name | STRING | — | |
| type | COMBO | png | 2 options: png, jpg |
| compress_level | INT | 40–9 | — |
Outputs (0)
No outputs