Nodes/ComfyUI-Aaalice-Nodes/💾 Conditional Save Image
ComfyUI Node

💾 Conditional Save Image

A save node with an off switch — the one thing ComfyUI's save nodes refuse to be

By Aaalice233·Created 2 months ago·Updated 8 days ago· 25
💾 Conditional Save Image
  • images
  • metadata
  • images
enabledtrue
filename_prefixComfyUI
file_formatpng
lossless_webpfalse
quality100
webp_method6
jpeg_subsampling0
embed_workflowfalse
save_with_metadatatrue
add_loras_to_prompttrue
add_counter_to_filenametrue
save_as_recipefalse

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, jpeg or webp (default png), with quality, lossless_webp, webp_method and jpeg_subsampling tuning alongside.
  • save_with_metadata, embed_workflow, add_counter_to_filename, save_as_recipe - the usual ComfyUI save toggles.
  • metadata (optional) - an METADATA socket for LoraManager's Metadata Overwrite output. 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 images are 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.

CategoryAaalice/tools

Inputs (14)

NameTypeDefaultDescription
imagesIMAGEImages to save (passed through unchanged).
enabledBOOLEANtrueWhen off, nothing is saved and the images are passed through unchanged.
filename_prefixSTRINGComfyUIBase filename. With LoraManager installed, patterns like %seed%/%date:...% are supported.
file_formatCOMBOpng3 options: png, jpeg, webp
lossless_webpBOOLEANfalse
qualityINT1001–100
webp_methodINT60–6
jpeg_subsamplingINT00–2
embed_workflowBOOLEANfalse
save_with_metadataBOOLEANtrue
add_loras_to_promptBOOLEANtrue
add_counter_to_filenameBOOLEANtrue
save_as_recipeBOOLEANfalse
metadataoptMETADATAOptional Metadata Overwrite dependency or complete parameters from Image Metadata Extractor.

Outputs (1)

NameTypeDescription
imagesIMAGEThe unchanged input images.