Batch Save Latent & Image
Batch Save Latent & Image
- latent
- image
This node dumps latents and their matching decoded images to disk, in a batch, with names you choose. That's it - and if that sounds like plumbing, it is, but it's the useful kind. The reason it exists is memory. Save your stage-one latents, let ComfyUI free the VRAM the first model was hogging, then reload them later when you actually need them.
Why you'd reach for it
The classic case is a two-stage pipeline where each stage wants a different model in memory. Someone on r/StableDiffusion laid out the exact motivation: run a bunch of stage-one renders, save the latents, delete the boring ones, and come back to only the good "starts" for the expensive second pass - no model swapping mid-run, no re-computing steps you already paid for. It's seed-farming and VRAM-splitting in one move, and it's a genuinely old ComfyUI trick for carving a heavy workflow into independent sub-parts.
Now the honest caveat, because a good friend tells you this part: ComfyUI already ships built-in Save Latent and Load Latent nodes, and it's gotten a lot better at juggling memory on its own - one experienced user in that same thread flat-out said "ComfyUI is really good at optimizing all by itself nowadays." So you often don't need to hand-manage latents anymore. What this pack's node adds over the stock one is the batch handling, named files, and - the actual differentiator - saving the image alongside the latent so a saved latent isn't an anonymous blob you have to re-decode to identify. If that pairing is what you want, reach for this; if you just need one latent parked, the built-in is fewer moving parts.
How it works
A latent is the compressed representation the diffusion model actually works in - the VAE encodes pixels down to it and decodes back. Saving a latent means you can resume a workflow from mid-flight without re-running the sampler. This node takes a latent batch and an image batch, walks your list of filenames one line at a time, and writes each pair out. It's an output node, so it terminates a branch - nothing comes out the other side, the files just land on disk.
The inputs that matter
- latent and image - the two things being saved. You pass both, which means you VAE-decode to get the image and tap the latent in parallel.
- filenames - a multiline text box, one name per line (default
latent_1 / latent_2 / latent_3). The number of lines should match how many items are in your batch; that's the contract. - save_directory - defaults to
latents, which lands in ComfyUI'soutput/latentsfolder. A plain string, so you can point it wherever.
There are no outputs - the payload is the files written to disk. You pair this with Batch Load Latent & Image downstream (or in a later run) to pull them back.
Installing it
ComfyUI Manager, search "ComfyUI Unusual Tools," install, restart. Or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/Diohim/ComfyUI-Unusual-Tools
No models, no heavy dependencies. The node lands under the latent category.
Where people get tripped up
The pack's own README is refreshingly blunt about the failure modes, and they're the boring-but-real kind. If nothing saves: check the ComfyUI console for the actual error first, make sure the latents directory exists in your output folder, and confirm you have write permission there. If relative paths misbehave, hand it an absolute path instead. And keep your filename count honest - if you list three names but the batch has five items, don't be surprised when the bookkeeping doesn't line up. The whole save/load pair only works if both nodes agree on the directory and the names, so decide those once and keep them consistent.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — | |
| image | IMAGE | — | |
| filenames | STRING | latent_1 latent_2 latent_3 | — |
| save_directory | STRING | latents | — |
Outputs (0)
No outputs