Save Image Smart Prefix
Smart Prefix JPEG Saving
- image
- saved_path
SaveImageSmartPrefix is the output node at the end of the cover-art branch in the MiniMax Music Production Toolkit - the thing that turns a ComfyUI IMAGE tensor into a tidy, non-overwritten JPEG on disk and tells you where it put it. If you've ever run a batch and come back to find every run stomped the same output.png, you already know why a collision-handling saver earns its keep.
It's part of Johannes Plenio's production-focused pack for MiniMax Music 3, a ComfyUI-native text-to-music model (no API key, nothing hosted). The toolkit's shape is "pipeline in, release-ready files out": LLM prompt → music generation → repair/mastering → tags and artwork. This node is the artwork/cover step's final write. In the bundled example workflow the cover is generated by a FLUX.2 Klein branch, sized by the pack's MiniMaxSquareImageSize, and saved here - then the returned path is handed to the audio savers so the JPEG gets embedded into your FLAC/MP3 tags as cover art.
Why not just the default SaveImage?
ComfyUI's built-in SaveImage writes a PNG to output/ and embeds the whole workflow in it, which is great when you want to drag a result back onto the canvas to reconstruct the graph. That's not this job. This is the final artifact - album art that needs to live at a specific path and get wired onward. Three things the stock node can't do: it returns the saved path as a string you can route into other nodes, it writes JPEG (lossy, tiny, tag-friendly) instead of PNG, and it resolves collisions three different ways instead of a silent counter you can't control.
How it works
The node takes your IMAGE tensor, converts it to a PIL image, and resolves the prefix you gave it. That resolution is where the "smart" happens: %date:yyyy-MM-dd%-style tokens expand to real dates, ~ and environment variables expand, and relative paths resolve under ComfyUI/output/ - with a guard that refuses to let a relative prefix escape that directory. Then collision_mode decides what happens when the file already exists, and it saves as JPEG with your quality, optimize=True, and full-res chroma (no subsampling) so album-art text stays crisp.
The inputs that matter
There are five, and a beginner really sets two:
filename_prefix- normally wired from the toolkit'sMiniMax Output Pathsnode (artwork_prefix), giving you something likeaudio_minimax3/2026-09-01/artwork/SongName. You can also just type a path; the node adds.jpg.collision_mode-auto_increment(default) appends_001,_002…;overwritereplaces;error_if_existsfails loudly so nothing is silently clobbered.jpeg_quality- 50–100, default 95; the tooltip's right that ~90–95 is visually transparent for artwork.imageandcreate_directories- the pixels, and whether missing folders get created (default on; turn off only if you want a hard failure).
The single output, saved_path (STRING), is the absolute path of the written JPEG - wire it into the audio saver nodes for embedded cover metadata, or into anything else that needs to know the file.
Installing it
Same story as the rest of the pack - this node comes with it, not standalone:
cd ComfyUI/custom_nodes
git clone https://github.com/jplenio/ComfyUI-MiniMax-Music-Production-Toolkit.git
cd ComfyUI-MiniMax-Music-Production-Toolkit
python -m pip install -r requirements.txt
Use the Python that runs ComfyUI, restart, hard-refresh (Ctrl+F5) once. If it's published to the Comfy Registry, ComfyUI Manager installs it (and dependencies) for you. The requirements are deliberately small - scipy, soundfile, imageio-ffmpeg, mutagen, Pillow. No model weights ship in the pack; the FLUX.2 Klein cover model and MiniMax Music 3 files are separate downloads only if you run the full example workflow.
Gotchas
- JPEG drops the workflow. This is a final artifact saver, not a project file - don't drag these back onto the canvas expecting the graph. That's a feature here, just know it.
- Empty
filename_prefixraises a hard error, and withcreate_directoriesoff a missing folder fails deliberately - that's the pack being strict on purpose, not a bug. - The
%date:…%macro is Java-style (yyyy,MM,dd), not strftime - write%date:yyyy-MM-dd%, and it expands to e.g.2026-09-01.
One honest caveat from the author's own docs: audio tooling lives at the edge of the ComfyUI ecosystem in bespoke packs with their own dependency stacks, and this toolkit is no exception. The saver itself is one node, but the full production chain it plugs into is a real pipeline with real moving parts - worth it if you're shipping tracks, overkill if you just want a cute JPEG.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | ComfyUI IMAGE tensor to save as the cover JPG. | |
| filename_prefix | STRING | Output prefix/path for the JPG cover, normally produced by MiniMax Output Paths. The node adds .jpg and resolves collisions according to collision_mode. | |
| collision_mode | COMBO | auto_increment | What to do when the target file already exists: auto_increment creates a new numbered filename, overwrite replaces it, and error_if_exists stops with an error. |
| create_directories | BOOLEAN | true | Create missing output folders automatically. Disable only if you deliberately want saving to fail when the destination directory does not already exist. |
| jpeg_quality | INT | 9550–100 | JPEG encoding quality from 50 to 100. Higher values preserve more detail at larger file size; around 90–95 is normally visually transparent for album artwork. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| saved_path | STRING | — |