Zoey - 智能图像存储器
Save every image of a batch with its caption file
- images
- images
GuaranteedBatchSaver is the "I refuse to lose a batch of training images" node. It takes whatever images come down a wire, saves every single one as a PNG into a folder, and - the part that makes it a dataset tool rather than a screenshot button - writes a matching .txt caption file next to each image. If you've ever run a big batch and watched ComfyUI's SaveImage quietly drop frames or bury them in date folders with opaque names, you know exactly why "guaranteed" is in the name.
This is from the Zoey toolset (comfyui-ZoeyTool), a pack whose other half is folder loaders and batch croppers - the whole thing is clearly built around "batch generate → dump to disk → caption → train" loops, and this node is the middle of that pipeline. The default save_path is even a Windows tagging folder (D:/11aa打标), which tells you the author's real workflow: generate in bulk, then tag each image in a labeling tool. Which means the text you feed it is per-image caption material.
How it works
Wire an images batch in, set save_path, and run. Each image in the batch is saved as batchName_prefix_00001.png, 00002, … The caption goes in two places: the txte field writes one sidecar file per image, and if you also fill texts it writes a second, _alt-suffixed sidecar with that content. So you can write a prompt in one field and a short tag summary in the other, or use one and ignore the other - save_txt toggles caption writing entirely.
The numbering controls are the things you'll actually touch:
digits- zero-pad width (default 5, so00001).start_index- where numbering begins (default 1).batch_name,prefix,separator- combine to build the file stem, e.g.train_batch_00001.png.overwrite_mode- the interesting one. Off (default) keeps an internal counter per save folder so repeated runs continue numbering instead of stomping your earlier files. On, it forces every run to start back atstart_index- meaning later files get overwritten. That's the toggle for "I want a fresh clean dataset every run" vs "never lose what I already saved."
Outputs are just images passed straight through, so you can chain this node mid-graph without breaking the flow.
Installing it
Same as every node in this pack - install comfyui-ZoeyTool once:
cd ComfyUI/custom_nodes
git clone https://github.com/liangzoey/comfyui-ZoeyTool.git
cd comfyui-ZoeyTool
pip install -r requirements.txt
Restart ComfyUI (or use ComfyUI Manager and search comfyui-ZoeyTool). No models, no extra downloads - pure disk I/O plus Pillow.
Where people get burned
First, the default save_path is a literal D:/… Windows folder; on any other machine nothing is a D: drive and it will silently create the folder relative to wherever ComfyUI thinks that is. Set it to an absolute path you can see. Second, watch overwrite_mode - if you've been running in sequential mode and flip it on expecting "still sequential," it goes back to start_index and overwrites your existing 00001.png on the next run. Third, don't expect the caption to be clever: whatever string is in the field gets written verbatim to every image's sidecar. If you want truly per-image captions, run this once per image (it's happy with a single-image batch), which is exactly the loop the folder loaders in this pack are designed to feed.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| save_path | STRING | D:/11aa打标 | — |
| prefix | STRING | batch | — |
| separator | STRING | _ | — |
| digits | INT | 51–8 | — |
| text_suffix | STRING | txt | — |
| start_index | INT | 1 | — |
| save_txt | BOOLEAN | true | — |
| overwrite_mode | BOOLEAN | false | — |
| txteopt | STRING | — | |
| textsopt | STRING | — | |
| batch_nameopt | STRING | train | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |