Universal Artist/Tag Randomizer
A Seeded Artist/Tag Randomizer That Actually Reads JSON
- Prompt
- Selected JSON
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. Withduplicate_policyatautoit samples without replacement unless you ask for more than the pool holds, then it repeats;unique_onlyandallow_duplicatesare the strict variants.sequential- walks the pool starting at theseedindex. 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.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| file_name | COMBO | 1 options: artists.json | |
| field_paths | STRING | name | — |
| extract_count | INT | 11–200 | — |
| mode | COMBO | 3 options: random, polling, sequential | |
| duplicate_policy | COMBO | 3 options: auto, allow_duplicates, unique_only | |
| output_format | COMBO | 6 options: anima, artist, weighted_artist, tags, nai, custom | |
| prefix | STRING | — | |
| suffix | STRING | — | |
| separator | STRING | , | — |
| seed | INT | 00–18446744073709550000 | — |
| filter_path | STRING | — | |
| filter_value | STRING | — | |
| filter_mode | COMBO | 3 options: contains, equals, not_empty | |
| weight_min | FLOAT | 1.00–5 | — |
| weight_max | FLOAT | 1.00–5 | — |
| custom_template | STRING | {tag} | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Prompt | STRING | — |
| Selected JSON | STRING | — |