💾 Conditional Save Image
A save node with an off switch — the one thing ComfyUI's save nodes refuse to be
- images
- metadata
- images
Here's a ComfyUI quirk that burns people for months: save nodes are output nodes, and the executor runs output nodes unconditionally. Sticking a Save Image upstream of a toggle or an "if" node does nothing to stop the write - the file hits disk every queue regardless. The only classic workaround is muting the node (Ctrl+M) before each run, and everyone forgets to re-enable it. ConditionalSaveImage fixes this by building the switch into the save node.
It's exactly what it sounds like: a save node with an enabled boolean. Off means nothing is written and the images pass through untouched. On means it saves like normal. That's the whole trick, and it's genuinely the cleanest way to make saving conditional.
The inputs that matter
- enabled (
BOOLEAN, default on) - the whole point. Flip it off and the node becomes a pure pass-through: no disk write, and the save-related controls grey out. - images - what you're saving, and always passed through unchanged on the output.
- filename_prefix - base name. With LoraManager installed you get
%seed%and%date:...%patterns; without it, plain prefixes. - file_format -
png,jpegorwebp(default png), withquality,lossless_webp,webp_methodandjpeg_subsamplingtuning alongside. - save_with_metadata, embed_workflow, add_counter_to_filename, save_as_recipe - the usual ComfyUI save toggles.
- metadata (optional) - an
METADATAsocket for LoraManager'sMetadata Overwriteoutput. Plugging it in guarantees the overwrite node executes before this save, which is the fiddly execution-order problem this socket quietly solves.
Output is a single images pass-through.
How the internals work
Saving is a side effect, so the node refuses to serve from cache - every run gets a fresh fingerprint, which is what makes it safe to toggle mid-session. When enabled, it checks whether ComfyUI-Lora-Manager is installed and, if so, delegates to LoraManager's own save implementation. That's where the %seed% filename patterns, jpeg/webp output, recipes and metadata overwrite come from. Without LoraManager it falls back to ComfyUI's core PNG save - and if you ask it for jpeg, webp or a recipe without the dependency, it errors clearly instead of silently writing the wrong thing. So the feature set you actually get depends on one install.
Because enabled is a plain boolean input, you can drive it from elsewhere: a dashboard toggle, another node's output, a random seed check - save every third batch, or only when a quality probe passes. That's where this node gets fun.
Install
Same pack as the rest of Aaalice's nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Aaalice233/ComfyUI-Aaalice-Nodes.git
cd ComfyUI-Aaalice-Nodes
pip install -r requirements.txt
or search ComfyUI-Aaalice-Nodes in ComfyUI Manager. Restart afterwards. No models, and the only extra dependency is certifi.
Gotchas
- Without LoraManager you're on PNG-only save with a plain prefix. If that's fine, you don't need anything else.
- It's a V3-node pack: you need a recent ComfyUI that supports the new node API, and it won't work in App Mode.
- The pass-through is real - the output
imagesare byte-for-byte the input, so you can chain this in the middle of a graph and keep previewing downstream. It doesn't just sit at the end like a normal save node.
If you've ever lost a good image to "oh wait, I forgot to unmute the save node", you know exactly why this exists.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Images to save (passed through unchanged). | |
| enabled | BOOLEAN | true | When off, nothing is saved and the images are passed through unchanged. |
| filename_prefix | STRING | ComfyUI | Base filename. With LoraManager installed, patterns like %seed%/%date:...% are supported. |
| file_format | COMBO | png | 3 options: png, jpeg, webp |
| lossless_webp | BOOLEAN | false | — |
| quality | INT | 1001–100 | — |
| webp_method | INT | 60–6 | — |
| jpeg_subsampling | INT | 00–2 | — |
| embed_workflow | BOOLEAN | false | — |
| save_with_metadata | BOOLEAN | true | — |
| add_loras_to_prompt | BOOLEAN | true | — |
| add_counter_to_filename | BOOLEAN | true | — |
| save_as_recipe | BOOLEAN | false | — |
| metadataopt | METADATA | Optional Metadata Overwrite dependency or complete parameters from Image Metadata Extractor. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | The unchanged input images. |