Nodes/ComfyUI Universal Extractor/Universal Artist/Tag Randomizer
ComfyUI Node

Universal Artist/Tag Randomizer

A Seeded Artist/Tag Randomizer That Actually Reads JSON

By Tera-Dark·Created 5 months ago·Updated 4 days ago· 3
Universal Artist/Tag Randomizer
    • Prompt
    • Selected JSON
    file_name
    field_pathsname
    extract_count1
    mode
    duplicate_policy
    output_format
    prefix
    suffix
    separator,
    seed0
    filter_path
    filter_value
    filter_mode
    weight_min1.0
    weight_max1.0
    custom_template{tag}

    If you batch-generate anime images and wish ComfyUI would just pick a different artist every run - reproducibly, on a seed - this is the node. UniversalJsonSegmentRandomizer (the UI calls it "Universal Artist/Tag Randomizer") pulls named segments out of JSON library files and assembles them into ready-to-paste prompt strings. It lives inside the ComfyUI Universal Extractor pack, which is really two things in one: this randomizer node plus a full browser-based gallery workspace. You can ignore the gallery; the node stands alone fine.

    Why you'd reach for it. In the anime ecosystem, Danbooru's tag vocabulary basically is the prompting language - artist names and tags are the prompt. The pack ships a data/artists.json with 43,000+ Danbooru artists (name, aliases, post counts), so you get a genuinely large, curated pool out of the box instead of a hand-typed list. Think of it as the modern cousin of A1111 wildcard {this|that} syntax: same "surprise me every batch" energy, but backed by real data and fully seedable, so a generation is exactly reproducible. It's all local too - no API, no key, nothing uploaded.

    How it works. A pipeline in three stages. First, field_paths resolves dotted paths into each JSON entry - name, other_names, meta.tags, or tags.* where * walks arrays and dicts (comma, newline, or semicolon separated). Next, optional filter_path / filter_value / filter_mode (contains, equals, not_empty) prune whole entries before sampling, so you can narrow to a specific style or tag pool. Then the selection mode kicks in:

    • random - seeded RNG, fully reproducible. With duplicate_policy at auto it samples without replacement unless you ask for more than the pool holds, then it repeats; unique_only and allow_duplicates are the strict variants.
    • sequential - walks the pool starting at the seed index. Deterministic rotation, useful if you want ordered batches.
    • polling - advances an in-process pointer each run so consecutive generations in one session never repeat. Caveat: that state lives in the Python process, keyed by node id + library + fields + filter + pool + seed, and resets to the seed position when you restart ComfyUI.

    Finally, output_format does the formatting, and this is where the anime focus shows. artist gives artist:name, anima gives @name (alias) for Anima checkpoints, nai gives NAI-style 1.0::name :: weight segments, weighted_artist wraps in (name:1.0) with a random weight between weight_min and weight_max (also seeded, so reproducible), tags stays raw, and custom lets you template with {tag}, {clean}, {anima}, {index}.

    Outputs. Two: Prompt, the joined string you wire into your CLIP text encode, and Selected JSON, the raw picked segments as JSON. That second output is genuinely handy - most randomizer nodes are a black box, and here you can see exactly what got picked and debug the formatting.

    Install. Easiest through ComfyUI Manager - search "Universal Extractor". Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Tera-Dark/ComfyUI-Universal-Extractor.git
    pip install -r ComfyUI-Universal-Extractor/requirements.txt
    

    Then restart ComfyUI. There's also comfy node registry-install tera-universal-extractor. Good news: the only Python dependency is Pillow (>=10.0.0) and there are zero models to download - the artist library ships inside the repo. The pack wants ComfyUI 0.3.0+ and Python 3.10+. The one surprise: it's not a one-trick node, so the install drags in the whole gallery UI even if you only use the randomizer.

    Common issues. After a pack update, if the error panel throws Failed to convert an input value to a FLOAT/INT value with messages like weight_max ... '' or seed ... 'contains', your browser is still holding the old node definition - restart ComfyUI and hard-refresh the page. If the misaligned state got saved into the workflow, delete and re-place the node to get clean parameters. And remember the node only reads plain .json libraries in data/ - runtime state files aren't valid picks.

    For most workflows, random mode, auto duplicates, and artist or anima output is all you'll ever touch. Wire a seed input to your sampler's seed and you get endless reproducible variations instead of a dice roll you can't audit.

    CategoryUniversal Tools

    Inputs (16)

    NameTypeDefaultDescription
    file_nameCOMBO1 options: artists.json
    field_pathsSTRINGname
    extract_countINT11–200
    modeCOMBO3 options: random, polling, sequential
    duplicate_policyCOMBO3 options: auto, allow_duplicates, unique_only
    output_formatCOMBO6 options: anima, artist, weighted_artist, tags, nai, custom
    prefixSTRING
    suffixSTRING
    separatorSTRING,
    seedINT00–18446744073709550000
    filter_pathSTRING
    filter_valueSTRING
    filter_modeCOMBO3 options: contains, equals, not_empty
    weight_minFLOAT1.00–5
    weight_maxFLOAT1.00–5
    custom_templateSTRING{tag}

    Outputs (2)

    NameTypeDescription
    PromptSTRING
    Selected JSONSTRING