ComfyUI Node

Image Auto Selector

Pick the best available image out of up to three candidates

By zhangp365·Created 2 years ago·Updated 5 months ago· 134
Image Auto Selector
  • image_prior
  • image_alternative
  • image_third
  • image

The image version of a fallback chain: wire up to three candidate images in, and this node returns the first one that's actually there. It's the natural pairing for this pack's *WithSwitch loaders and compositors - nodes that can come back empty when their enabled toggle is off - giving you a clean way to say "use this if it exists, otherwise fall back."

How the priority works

All three inputs are optional, and none are required - which means it's entirely on you to wire at least one, since there's nothing here to fall back to if all three are empty. Per the author's description: if image_prior isn't empty, that's what comes out. If it is, image_alternative is checked next, and image_third after that.

  • image_prior - your first choice, checked first.
  • image_alternative - the fallback if image_prior isn't connected or came back empty.
  • image_third - the last resort, checked only if neither of the first two produced anything.

Output: a single image (IMAGE) - whichever candidate actually won.

Where this is genuinely useful

Chain it after a refinement or upscale step: wire the upscaled result into image_prior, the pre-upscale base image into image_alternative, and you get the refined output whenever it exists but a graceful fallback whenever that branch was skipped or disabled - without a conditional node or manual rewiring depending on which path ran. Pair it with LoadImageWithSwitch: if the loader's enabled is off, wire its output into image_prior and something generated in-graph into image_alternative, and this node quietly picks whichever one is real.

It also composes with itself across multiple three-way chains if you genuinely need more than three fallback levels - feed the output of one selector into the image_third slot of another - though at that point it's worth asking whether the graph itself needs simplifying rather than stacking selectors deeper.

Installing it

ComfyUI Manager: search "ComfyUI-utils-nodes." Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes

Restart ComfyUI. No dependencies, no models - pure input-picking logic.

The one thing to get right

Wire at least the first slot you actually intend to use, and don't assume the node will politely error if all three are empty - check what actually comes out downstream if you're not sure a given run is going to produce a candidate at all. If you're seeing an unexpected image further down the graph, work backward through image_priorimage_alternativeimage_third in that order; the earliest connected one that's non-empty is always what wins, regardless of which one you meant to be using that run.

Categoryutils/image

Inputs (3)

NameTypeDefaultDescription
image_prioroptIMAGE
image_alternativeoptIMAGE
image_thirdoptIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE