đź’€Save By File Name
Save with the filename you actually wanted, without touching the pixel data
- image
- video
- file_path
- filename
ComfyUI's default save node names everything by a timestamp-and-counter scheme, and renaming hundreds of outputs by hand afterward is soul-destroying. The đź’€Prepack Save By File Name is the fix: a save node that uses your filename, straight up. Type my_scene_{timestamp} and that's what lands in the output folder. It handles images, video, and text, detects the format from the extension you give it, and - the part that surprised me - preserves the original file's format and content by copying it directly rather than re-encoding, so nothing gets mangled on the way out.
For anyone who's ever generated a batch and needed every file to carry a meaningful name, this is the node you install a whole pack for.
How it works
Three optional inputs, and you connect exactly one: image (IMAGE - PNG, JPG, JPEG, GIF, WebP, APNG, with animation preserved), video (wildcard - MP4, AVI), or text (STRING - saved as a .txt). The node figures out which one you plugged in and ignores the rest.
The filename field is where the power lives. It's a base name, and the tooltip lays out the rules: add an extension like .webp or .jpg to force a specific format, and use {date}, {time}, or {timestamp} placeholders for dynamic names. So render_{timestamp}.png becomes a unique, descriptive filename every run. The overwrite dropdown (default false) controls what happens on a collision - false appends a suffix instead of clobbering the existing file, true replaces it.
The interesting mechanism: when you feed it an image or video, it first tries to find the source file on disk (e.g. from a video loader or an image that was loaded from disk), and if found it copies that file with the new name - no re-encode, byte-for-byte identical, animation and metadata intact. Only when there's no source file does it fall back to saving the tensor data, and in that path it honors your extension choice and detects the format from the tensor metadata when you didn't specify one.
The two outputs - file_path (the full path to the saved file) and filename (the final name used) - let you log or reference exactly where the file went.
Where people get burned
Connect one input. If you wire both image and text, only the first one checked (image) is saved and the other is ignored - the node doesn't tell you. And remember this is is_output_node true: it's a terminal node, so it belongs at the end of the chain, not mid-graph.
Installing it
It's in the Prepack pack:
cd ComfyUI/custom_nodes
git clone https://github.com/S4MUEL-404/ComfyUI-Prepack.git
pip install -r ComfyUI-Prepack/requirements.txt
The requirements file lists opencv-python as optional - it's only needed for video saving, so if you only save images you can skip it and the node still works. Or search "Prepack" in ComfyUI Manager.
Restart and find it under đź’€Prepack. If a video fails to save with an import error, that's the optional dependency missing - pip install opencv-python in your ComfyUI environment fixes it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| filename | STRING | output | Base filename. Add .webp, .jpg, .png etc. to force specific format. Supports {date}, {time}, {timestamp} placeholders. |
| overwrite | COMBO | false | Whether to overwrite existing files or add suffix. |
| imageopt | IMAGE | Image files: PNG, JPG, JPEG, GIF, WebP, APNG formats (preserves animation). | |
| videoopt | * | Video files: MP4, AVI formats. | |
| textopt | STRING | Text content to save as file. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| file_path | STRING | Full path to the renamed file. |
| filename | STRING | Final filename used for renaming. |