Image Save YC
A save node that actually names your files and writes captions too
- images
- images
- filenames
Core ComfyUI's SaveImage writes files with a predictable prefix_00001.png scheme and calls it a day. That's fine until you're building a dataset, organizing a batch by intent, or wanting a .txt caption sitting next to every image - at which point you discover the naming is the whole problem. YC_Image_Save is a save node that takes filenames seriously: configurable prefixes, delimiters, number formatting, number position, a numbering strategy that understands formats, a choice of seven extensions, and optional caption sidecar files. It still passes the image through as an output, so it doesn't dead-end your graph.
How it works
On each run it picks an output directory (your ComfyUI/output by default, or any path you type), figures out the next number based on your strategy, and writes the image. Two numbering strategies matter:
- format_match - scans for files matching your exact naming pattern and increments from there. Two different prefixes in the same folder each get their own sequence, which is what you want when you're saving several series side by side.
- global_increment - counts every file in the directory regardless of name, so the sequence is shared across everything.
Numbering itself can be none (no number at all - your filename prefix verbatim), normal, or padded (fixed width like 001). Position is suffix or prefix; the delimiter is whatever you like, and it doubles as a decoration character. Quality is fixed at 100, which is a deliberate choice: this node never compresses your output silently.
The inputs that matter
- images - the batch to save.
- output_path - relative paths resolve under your ComfyUI
outputfolder; absolute paths go wherever you point them. It creates missing directories for you. - filename_prefix - the base name, default
ComfyUI. - filename_number_mode / _padding / _position / _strategy - the four knobs above.
padded+suffix+format_matchis the sane default combo. - extension -
png,jpg,jpeg,gif,tiff,webp,bmp. - caption - optional text; if provided, a sidecar
.txt(extension set by caption_file_extension) is written next to the image.
Outputs are images (passed through) and filenames - the actual paths written, which is rare and useful for downstream tooling that needs to know what just got saved.
The workflow it's built for
This is a dataset-prep node as much as a save node. The caption sidecar is exactly what LoRA/dataset loaders expect - image + same-name .txt - so you can pipe a batch of generated crops with captions straight into a training prep folder and skip a manual rename step. For everything else, it's the "I want my files organized before I look at them" save button.
Installing it
Part of ComfyUI-YCNodes. ComfyUI Manager → search ComfyUI-YCNodes → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes
Restart, then look under YCNode/Image. Needs only PIL and torch from the pack's requirements.
Gotchas
If your filename numbering ever looks off, check format_match versus what's actually in the folder - a stray prefix_00005.png from a different session will quietly bump the counter, and format_match is precise about it while global_increment is not. The caption field only produces a file when it's actually connected and non-empty; an empty caption just skips the sidecar. And note it's an output node - wire it as a graph terminus, but it still emits its inputs, so you can chain a second save or a preview after it without issue.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| output_path | STRING | — | |
| filename_prefix | STRING | ComfyUI | — |
| filename_delimiter | STRING | _ | 分隔符或装饰符,可用于分隔前缀和序号,或纯粹作为装饰添加 |
| filename_number_mode | COMBO | 3 options: none, normal, padded | |
| filename_number_padding | INT | 21–9 | — |
| filename_number_position | COMBO | 2 options: suffix, prefix | |
| filename_number_strategy | COMBO | format_match: 只匹配相同格式文件递增; global_increment: 按目录所有文件数量递增 | |
| extension | COMBO | 7 options: png, jpg, jpeg, gif, tiff, webp, +1 | |
| captionopt | STRING | — | |
| caption_file_extensionopt | STRING | .txt | 文本文件的扩展名 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| filenames | STRING | — |