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

Tag Merger [LP]

Combine two tag strings into one without duplicating everything

By LevelPixel·Created 2 years ago·Updated 5 months ago· 31
Tag Merger [LP]
    • result
    tags1
    tags2
    under_scoretrue

    Anyone who's built a captioning or auto-tagging pipeline with more than one source knows the annoyance: an autotagger gives you one tag string, your manual notes give you another, and now you're supposed to combine them by hand without ending up with 1girl listed twice. Tag Merger is the node that does that combining step for you.

    What it does

    Feed it two tag strings and it returns one merged result - the obvious use case being an autotagger's output on one side and a hand-written or template-derived tag set on the other, combined into a single prompt-ready string rather than concatenated with a duplicate mess. It sits in the same Tags family as this pack's category-filtering nodes, so a natural place for it in a pipeline is right before or after those: merge two sources into one string, then run the result through Tag Category Filter or Tag Category Keeper if you also need to trim it down by category.

    Inputs and outputs that matter

    • tags1 (required, defaults to empty) - the first tag string.
    • tags2 (required, defaults to empty) - the second tag string, merged in with the first.
    • under_score (required, boolean, defaults to true) - a formatting toggle. Its exact effect isn't spelled out beyond the name, but the obvious reading, given how Danbooru-style tags are conventionally written with underscores joining multi-word tags (blue_sky rather than blue sky), is that it controls whether the merge treats underscore and space variants of the same tag as duplicates, and/or normalizes the output to one format or the other. Worth testing on a tag pair you know overlaps (one written with underscores, one with spaces) to see exactly what it does before relying on it for deduplication.

    Output: result - the merged tag string.

    Installing it

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

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

    Restart ComfyUI. Text processing only - no models, no extra dependencies.

    Common issues & troubleshooting

    Tags you expected to get deduplicated show up twice anyway. This is almost certainly a formatting mismatch rather than a bug - if one source writes long hair and the other writes long_hair, whether the merger treats those as "the same tag" depends entirely on what under_score is actually doing under the hood, which isn't documented in detail. If dedup is the whole reason you reached for this node, normalize both inputs to the same underscore/space convention before merging rather than trusting the toggle blindly, and confirm the behavior on a known pair first.

    Order of tags in the result isn't what you expected. The schema doesn't document whether tags1 tags always come before tags2 tags in the output, or whether merging reorders/sorts. If tag order matters for your downstream use (some tag-based prompting workflows put emphasis on earlier tags), check the actual output rather than assuming.

    You're merging more than two sources. This node only takes two inputs. For three or more tag strings, you'll need to chain Tag Merger nodes - feed the result of one merge into tags1 (or tags2) of the next - or look at this pack's Text To List node if what you actually want is a list of separate strings rather than one combined tag string.

    CategoryLevelPixel/Tags

    Inputs (3)

    NameTypeDefaultDescription
    tags1STRING
    tags2STRING
    under_scoreBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    resultSTRING