Nodes/Mikey Nodes/Save Image If True (Mikey)
ComfyUI Node

Save Image If True (Mikey)

Save Image If True (Mikey Nodes) — a save node with a gate on it

By bash-j·Created 3 years ago·Updated 11 months ago· 188
Save Image If True (Mikey)
  • image
    save_condition0
    filename_prefix

    Most save nodes save unconditionally - the image reaches the node, the image hits disk. This one adds exactly one thing on top of that: a condition. If the gate isn't satisfied, nothing gets written.

    What it does

    Straight from the pack's own Additional Nodes list: "Saves the image only when a given save condition is met." The mechanism is a single INT input, save_condition, constrained to 0 or 1 - effectively a boolean wearing an integer's clothes, which is a common pattern in ComfyUI where a lot of node sockets are typed as INT/FLOAT rather than a dedicated boolean type. Feed it 1 and the image saves; feed it 0 and it doesn't. Nothing downstream connects to this node (is_output_node is true, same as any terminal save node), so whatever decides save_condition needs to live earlier in your graph.

    The obvious use case: automated filtering. Wire an NSFW check, a quality/similarity comparison, or any other node that outputs a pass/fail signal into save_condition, and you stop writing rejects to disk in the first place - instead of generating a batch, saving everything, and manually deleting the bad ones afterward, the bad ones simply never get written.

    The inputs that matter

    • image - the image to conditionally save.
    • save_condition - the gate itself, 0 or 1.
    • filename_prefix - an optional string prefix for the saved filename, same idea as ComfyUI's core Save Image node's field of the same name (and you can wire in Mikey Nodes' own FileNamePrefix node here if you want richer filename logic on top).

    Installing

    Part of the full Mikey Nodes pack. ComfyUI Manager: search "Mikey Nodes," install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/bash-j/mikey_nodes, restart ComfyUI. No models or heavy dependencies - pure conditional logic plus a file write.

    Where it's easy to get wrong

    • Wiring a boolean-shaped output into an INT socket and getting a type mismatch. Depending on what upstream node is producing your pass/fail signal, you may need a small conversion step to get a clean 0/1 integer into save_condition rather than a native boolean type - check what the node immediately upstream actually outputs before assuming it'll connect directly.
    • Forgetting the node saves nothing when the condition is 0 - including no error, no log, nothing. That's the intended behavior, but it means if you're troubleshooting "why didn't this image save," the very first thing to check is whether save_condition actually evaluated to 1 for that run, not whether the node itself is broken.
    • Using this as your only save node in a batch and losing track of what got skipped. Because failed conditions produce no output at all, you can end up with a batch where some images are simply missing with no trace. If you need to audit what got filtered and why, consider also saving with an unconditional node (into a separate "rejects" folder, say) rather than relying on this node alone for a batch you care about auditing later.
    CategoryMikey/Image

    Inputs (3)

    NameTypeDefaultDescription
    imageIMAGE
    save_conditionINT00–1
    filename_prefixSTRING

    Outputs (0)

    No outputs