Nodes/ComfyUI Level Pixel/Tag Switcher [LP]
ComfyUI Node

Tag Switcher [LP]

Pick which image flows through based on which tags are present

By LevelPixel·Created 2 years ago·Updated 5 months ago· 31
Tag Switcher [LP]
  • default_image
  • image1
  • image2
  • image3
  • image4
  • image
input_tags
tags1
any1true
tags2
any2true
tags3
any3true
tags4
any4true

Most of this pack's Tags nodes operate on the tag string itself - filtering, replacing, merging it. Tag Switcher does something different: it uses tags to make a routing decision about a completely different piece of data, an image. Feed it the tags describing your current input and up to four candidate branches, and it hands back whichever image matches.

What it does

The shape of it, read straight off the schema: you give it input_tags - the tag string you're checking - plus up to four numbered slots (tags1/image1 through tags4/image4), each pairing a set of candidate tags with an image to output if that set matches. Each slot also carries its own any boolean flag, which reads naturally as a toggle between "match if any of this slot's tags appear in input_tags" versus requiring all of them - the exact matching semantics (substring match, comma-split exact match, etc.) aren't spelled out in the schema, so confirm on a known case before relying on it. If nothing matches, default_image is what comes out instead, so this node always resolves to something rather than erroring on a miss.

Think of it as a conditional router for a workflow that branches on content: an autotagger or LLM captioner produces tags for whatever's currently in the pipeline, and depending on which tags show up, you want a different reference image, a different style guide, or a different overlay fed downstream - without hand-wiring a chain of separate if nodes. Note it's flagged as an output node in its own schema, meaning it executes even if nothing downstream is connected to its result, which matters if you're using it for logging or preview purposes rather than feeding its output further into the graph.

Inputs and outputs that matter

  • input_tags (required, string) - the tags you're checking against the candidate branches.
  • default_image (required, image) - what gets returned if none of the candidate tag sets match.
  • tags1/image1/any1 (required) - the first candidate branch: a tag set, the image to return if it matches, and the any-vs-all match toggle.
  • tags2tags4, image2image4, any2any4 (optional) - up to three more candidate branches, same shape.

Output: image - whichever image the matched branch (or the default) resolves to.

Installing it

Through ComfyUI Manager, search "ComfyUI Level Pixel" or "ComfyUI-LevelPixel." Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git

Restart ComfyUI. No models required for the switching logic itself - whatever produces your input tags (an autotagger, an LLM node, manual entry) is a separate dependency.

Common issues & troubleshooting

It always falls through to default_image. Since the exact match logic (substring vs. exact token vs. comma-delimited comparison) isn't documented, mismatched formatting between input_tags and a slot's tagsN - extra spaces, underscores vs. spaces, different casing - is the most likely cause. Test with input_tags copied verbatim from one of your slot's tag fields to confirm a match fires at all before troubleshooting further.

More than four candidate branches needed. The node caps out at four numbered slots plus the default. For a longer list of conditions, you'd need to chain a second Tag Switcher off the first one's output (wired in as that switcher's default_image) to extend the branching.

Unsure which slot actually fired. There's no separate output telling you which branch matched - only the resulting image. If you need to debug which condition triggered, temporarily swap in visibly distinct placeholder images per slot so you can tell at a glance which one made it through.

CategoryLevelPixel/Tags

Inputs (14)

NameTypeDefaultDescription
input_tagsSTRING
default_imageIMAGE
tags1STRING
image1IMAGE
any1BOOLEANtrue
tags2optSTRING
image2optIMAGE
any2optBOOLEANtrue
tags3optSTRING
image3optIMAGE
any3optBOOLEANtrue
tags4optSTRING
image4optIMAGE
any4optBOOLEANtrue

Outputs (1)

NameTypeDescription
imageIMAGE