💾 智能按文件名保存
Save images under names you actually choose, not timestamp spam
- images
ComfyUI's stock SaveImage names everything by timestamp plus counter, which is fine until you're doing a character batch or a folder of variations and you want files called 角色1_01.png instead of ComfyUI_00012_.png. That's the entire job of this little utility node: give it images and a matching list of filenames, and it saves each one under a name you control, with collision-safe renaming and an optional subfolder.
It sits in the pack's Nkxx/Tools category and it's refreshingly boring - a local node, no API, no key, no credits. It's the "命名细化版导出" (named refined export) step that the author's bundled workflows use to dump per-character results into tidy folders.
The inputs:
- images - the IMAGE batch.
- filenames - the star of the show. A STRING where each line is one filename/path. One line per image, in order. The source treats each line as a full path, so you can even include subdirectories like
角色1/shot_aand it'll create them. - output_path - optional subfolder under ComfyUI's output directory. Leave it empty and the node saves next to whatever directory each filename line points at (which is useful when filenames are full paths from another node).
- suffix - a string appended to the filename's base before the extension. The bundled character workflow uses this to stamp
_01-style counters or tags across a batch.
It has no outputs - it's an output node, which is exactly what you want at the end of a chain.
Two behaviors worth knowing before you lean on it:
- Mismatch handling. If you hand it 6 images and 4 filenames, it saves the first 4 and prints a warning rather than crashing. Feed it 4 names and 6 images and two silently vanish, so keep the lists in lockstep.
- Collision handling. If a target file already exists, it doesn't overwrite - it appends
(1),(2), … like your OS would. Safe to re-run a queue.
It saves PNG (compressed at level 4) and shows a "成功保存 N 张高清图" toast in the UI, with proper subfolder metadata so your preview/history stays consistent.
Install is the pack-wide routine, since this node ships in ComfyUI-nkxx:
cd ComfyUI/custom_nodes
git clone https://github.com/jieg9341-lab/ComfyUI-nkxx
Restart and you'll find it under Tools. It has no model downloads and no special dependencies - the pack's auto-installed pandas/requests/etc. are irrelevant here; this is pure Pillow and folder_paths.
Where people get burned: feeding it a single filename string without newlines when you have a batch (it splits on newlines, so one unbroken string = one name for the whole batch), and forgetting that output_path is relative to ComfyUI's output root, not absolute. Otherwise it's one of those boring nodes you reach for constantly once you've used it. If your real complaint is that you want metadata or PNG info embedded, you'd pair it with a metadata-aware saver instead - this one is purely about filenames.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| filenames | STRING | — | |
| output_pathopt | STRING | — | |
| suffixopt | STRING | — |
Outputs (0)
No outputs