山竹文本路径保存
Save a .txt per image — with the image's dimensions in the filename
- images
ShanZhuTextSaver is a batch text saver wearing the pack's signature Chinese widget names. It takes an IMAGE batch plus a multiline texts string, treats each line of that text as one file's content, and writes a separate .txt per image. The rule is strict: the number of lines in texts must equal the number of images, or it raises ValueError: 错误:图像数量与文本数量不一致 (image count and text count don't match). One line per image, no exceptions.
Naming is where this node shows its personality. Each file becomes {文件名前缀}_text_{index:05}_{W}x{H}.txt - so ComfyUI_text_00000_1024x1024.txt - and the prefix literally appends _text to whatever you type. The _WxH comes from each image's actual tensor dimensions, which is a genuinely handy touch if you're organizing a mixed-resolution set. There's also collision handling: if a filename already exists, it bumps an appended counter (_00001, _00002, ...) rather than overwriting. 保存路径 (save path) sets the destination folder; leave it blank and files go to ComfyUI's default output directory.
Like the other saver nodes in the pack it's an output node - no wires out. Results show up in the UI as the list of saved paths (returned under a UI field also called 保存路径), which is a decent built-in audit trail.
Why would you use this over the core ComfyUI text saver? Mostly because you're already in this pack's ecosystem, or you're doing a dataset-prep pass where you have one text line per image - say, the output of a captioning run - and you want tidy per-image .txt files in one go. It's a one-shot convenience for exactly that shape of data.
Two gotchas. The widget names really are Chinese: on an English ComfyUI install you'll see 文件名前缀 and 保存路径 as input labels - a small taste of this pack's Chinese-first design. And remember the one-line-per-image rule: a stray blank line at the end of texts is still a line, and it'll make the node throw. Trim before you save. Install is the shared pack story: ComfyUI Manager ("ComfyUI_SZtools") or git clone https://github.com/Rocky-Lee-001/ComfyUI_SZtools into custom_nodes/, restart, done.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| texts | STRING | — | |
| 文件名前缀 | STRING | ComfyUI | — |
| 保存路径 | STRING | — |
Outputs (0)
No outputs