Nodes/ComfyUI Level Pixel/Tag Category Keeper [LP]
ComfyUI Node

Tag Category Keeper [LP]

Pull out just the tag categories you actually want

By LevelPixel·Created 2 years ago·Updated 6 months ago· 31
Tag Category Keeper [LP]
    • result
    tags
    include_categories

    This is the node the pack's own README uses to explain the whole category-filtering idea: if you need a description of only the background from an image's tag set, you set the "background" category here, and you get just that category back - nothing else. It's the simpler, one-directional sibling of Tag Category Filter: this one only keeps, it doesn't also exclude in the same step.

    What it does

    Feed it a full tag string and a list of categories you want to keep, and it strips everything that doesn't belong to one of those categories, returning only what matches. The underlying grouping logic comes from comfyui_tag_fillter, the same library credited for the pack's other Tags nodes. The practical use case is exactly what the README describes: an autotagger hands you a wall of mixed tags - subject, pose, clothing, background, style - and you want to isolate just one slice of that, say for a background-only prompt or a style-only reference, without manually picking through a comma-separated list by hand.

    As with Tag Category Filter, the exact set of valid category names isn't spelled out anywhere accessible beyond the one worked example in the README. Danbooru's own convention groups tags into General, Character, Artist, Copyright, and Meta, which is a reasonable reference point for how this kind of category system typically shakes out, but whether this node's categories match that exact set or use the underlying library's own scheme isn't confirmed by what's documented. The one category name you can rely on without guessing is "background," straight from the pack author's own example.

    Inputs and outputs that matter

    • tags (required, defaults to empty) - your full tag string.
    • include_categories (required, defaults to empty) - the categories to keep; everything else gets dropped.

    Output: result - the filtered tag string, containing only tags from the categories you named.

    Installing it

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

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

    Restart ComfyUI. No models, no extra dependencies.

    Where people get burned

    Same trap as its sibling: type a category name that isn't one the underlying library recognizes and you'll likely get back an empty result with no explanation of why, rather than an error telling you the name was wrong. Start from the README's confirmed example ("background") to sanity-check the node is working at all, then experiment outward to find whatever other category names it actually supports for your source data.

    The other thing worth knowing before you reach for this node instead of Tag Category Filter: this one is keep-only. If you need to both hold onto certain categories and separately exclude a couple of specific ones in the same pass, Tag Category Filter is the node with both levers - this one is the simpler tool for when you know exactly which categories you want and don't need to reason about exclusions at all.

    CategoryLevelPixel/Tags

    Inputs (2)

    NameTypeDefaultDescription
    tagsSTRING
    include_categoriesSTRING

    Outputs (1)

    NameTypeDescription
    resultSTRING