JLC Conditional Save Image
A save node that only renders the branch you picked
- image_on_true
- image_on_false
- selected_image
- image_save_path
At first glance JLC Conditional Save Image looks like a fancy way to save a PNG, which is roughly how the ComfyUI default already works. Look again: the inputs are lazy. The node only asks ComfyUI to execute the image branch you actually selected, so the whole point is that the other branch - an expensive ControlNet pipeline, a cache-prep proof - never runs at all. In the JLC Flux2 ControlNet ecosystem this is the node that sits at the end of both the cache-prep branch and the inference branch and decides which one gets written to disk.
Why you'd reach for it
The JLC Flux2 Conditioning Cache Prep node (and the specialist cache-prep nodes) outputs a cache_ready_image that's just a small CPU proof the cache got warmed. You don't want that cluttering your output folder every run. So you wire cache_ready_image into image_on_true, your final generated image into image_on_false, and drive switch from the same signal that gated the cache-prep run. TRUE means "we were prepping caches, save the proof," FALSE means "normal inference, save the real image." One node, both branches, no leftover files.
How it works
Both image inputs are declared lazy and the node's check_lazy_status requests only the selected one - this is ComfyUI's lazy-evaluation mechanism, and it's what makes the node a genuine branch selector, not just a filter. If switch is TRUE only image_on_true is fetched; flip it and only image_on_false runs. That's a real cost saving when one branch is a full FLUX.2 sample.
save_when is the other dial: FALSE, TRUE, BOTH, or NONE. It controls when a PNG gets written, not which branch executes - the selected branch still runs either way, which is exactly why the author calls it a cache-prep companion. Set save_when to NONE and it stops writing files entirely while still passing the selected image through, so it doubles as a plain branch selector.
The inputs you'll actually touch:
switch- branch selector. TRUE = cache-prep/proof branch in the standard JLC setup, FALSE = normal inference.save_when- which switch states write a PNG.filename_prefix- standard ComfyUI tokens plus%batch_num%.output_folder-output, a relative subfolder, or an absolute path.compress_level- PNG lossless level 0–9, metadata unaffected.
Outputs are selected_image (the image that was chosen) and image_save_path (a string, empty when nothing was saved).
Installing it
It ships in the JLC-Flux2-ControlNet pack, so you install the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Damkohler/JLC-Flux2-ControlNet.git
Restart ComfyUI, or search "JLC Flux2 ControlNet" in ComfyUI Manager. No extra Python dependencies and no model files for this node - the ControlNet checkpoint requirement only matters if you actually run a ControlNet branch.
Common traps
The classic mistake is misreading the two branches and saving the proof image as if it were the final render - if you see tiny or "No Images to Cache" images in your output, your switch and save_when are pointed at the wrong side. Also remember the caches are process-local: restart ComfyUI and the warmed caches are gone, so the "cache prep" branch has to run for real again. And if you connect a real generated image to the wrong input, the node won't complain - it just saves what you told it to save.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image_on_true | IMAGE | Lazy IMAGE used when switch is TRUE. In Flux2 cache workflows, this is commonly the cache-prep or proof branch. | |
| image_on_false | IMAGE | Lazy IMAGE used when switch is FALSE. In Flux2 cache workflows, this is commonly the final inference image branch. | |
| switch | BOOLEAN | false | Shared branch selector. Companion to the JLC Flux2 cache-prep nodes: TRUE usually selects cache prep; FALSE usually selects normal inference. |
| save_when | COMBO | FALSE | Which switch states write a PNG. The selected branch is still executed either way, which makes this node a cache-prep companion. |
| filename_prefix | STRING | ComfyUI | Filename prefix. Standard ComfyUI formatting tokens and %batch_num% are supported. |
| output_folder | STRING | output | Use 'output', a relative subfolder inside the ComfyUI output directory, or an absolute destination path. |
| compress_level | INT | 40–9 | PNG lossless compression: 0 = none/fastest/largest, 9 = strongest/slower/smallest. Does not affect metadata. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| selected_image | IMAGE | — |
| image_save_path | STRING | — |