TagSwitcher
Only show the 'fixed' image when the thing is actually in the frame
- default_image
- image1
- image2
- image3
- image4
- image
TagSwitcher is the one node in this pack that routes images, not just text. You give it a tag list, a default image, and up to four conditional image slots; it checks the tags and passes through the image whose conditions match - otherwise it hands back the default. It sounds niche until you hit the problem the author built it for: conditional inpainting that only applies when the thing you're removing is actually in the picture.
What it actually does
The canonical use case, straight from the README, is cat-ear removal. WD14 tagger reads your input image and produces a tag string. CLIPSeg masks what it thinks are animal ears, and a Big Lama Remover wipes them out of the image. The problem: CLIPSeg, when it can't find the target object in a frame, cheerfully masks some random region - and now you've erased an unrelated part of the image. TagSwitcher fixes that. Wire the WD14 tags into input_tags, set tags1 to animal_ears, cat_ears, and connect the erased image to image1. If the tags say animal ears are present, you get the erased image; if not, you get the untouched original. The mask node only gets to destroy pixels when the tag evidence says the target is actually there.
Mechanically, each of the four slots pairs a tag list with an image, plus a boolean. With any1 True (the default), the slot fires when any one of its tags appears in input_tags. Set it False and the slot requires all of them. Slots are checked in order 1 → 4, and the first match wins - so priority matters if you're stacking conditions. Nothing matches anywhere? You get default_image.
The inputs that matter
input_tags- the tag string you're testing against (typically WD14 tagger output).default_image- the fallback, usually your original image.tags1+image1+any1- the first conditional slot. The rest are the same pattern.
The single output is image (IMAGE type), so it plugs straight into a VAE Decode or another image node.
Where people get burned
The ordering gotcha: slots are evaluated 1 through 4 and the first hit wins. If tags1 is too broad it shadows everything below it, so put specific conditions first and broad ones last.
The subtler trap is the anyN flag with an empty tag list. In the default any-mode, an empty slot never fires - any() over an empty set is False, so unplugged slots are safe. But flip a slot to all-mode with empty tags and all() on an empty set is True, which means that slot matches every input and hijacks the output. If you're leaving a slot unused, keep anyN True and the tags empty.
And the practical one: a slot only does something if it has both a tag list and a wired image. Tags with no image gives you a None image downstream and a broken chain. Wire each slot you use completely, leave the rest alone.
Install
Part of the comfyui_tag_filter pack - ComfyUI Manager, search "comfyui_tag_filter", or:
cd ComfyUI/custom_nodes
git clone https://github.com/sugarkwork/comfyui_tag_fillter
Restart after. Zero dependencies, no model downloads. (The CLIPSeg and Big Lama nodes you'd pair it with are separate packs, so expect to install those too if you copy the cat-ear workflow.)
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| input_tags | STRING | — | |
| default_image | IMAGE | — | |
| tags1 | STRING | — | |
| image1 | IMAGE | — | |
| any1 | BOOLEAN | true | — |
| tags2opt | STRING | — | |
| image2opt | IMAGE | — | |
| any2opt | BOOLEAN | true | — |
| tags3opt | STRING | — | |
| image3opt | IMAGE | — | |
| any3opt | BOOLEAN | true | — |
| tags4opt | STRING | — | |
| image4opt | IMAGE | — | |
| any4opt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |