ComfyUI Node

Ranbooru

Roll a random booru tag set and stress-test your checkpoint

By Inzaniak·Created 3 years ago·Updated 3 months ago· 27
Ranbooru
    • TAGS
    • IMAGE
    • IMAGE_URL
    boorugelbooru
    max_pages0
    posts_per_page1
    seed0
    tags
    ratingAll
    change_colorDefault
    use_last_promptfalse
    return_picturefalse

    Ranbooru is the node the whole pack exists for. It reaches out to an imageboard (booru), grabs a random post, and hands you back that post's tags as a comma-separated string ready to drop straight into a CLIP Text Encode. The author built it to test checkpoints against a wide variety of tags instead of the same four prompts everyone writes by hand - and that's still the best thing it does. If you've ever downloaded a checkpoint and wanted to know what it actually handles, wire Ranbooru's TAGS output into your positive prompt, queue a few runs, and let randomness do the auditing.

    How it works

    Under the hood it's a thin wrapper over each booru's JSON API. Pick a booru, and the node chooses a random page, pulls posts_per_page posts, and picks one. Then it cleans house: parens get escaped, tags are shuffled, and anything on a hardcoded naughty list (watermark, text, signature, ai_generated, artist_name, character_name, censored - about sixty entries) is dropped before the tags are joined back with commas. It also quietly appends -animated to every API query, so you never get GIFs.

    If you care about NSFW filtering, the rating menu is honest about it: Sensitive, Questionable, and Explicit are right there, mapped per-booru (danbooru and gelbooru use their single-letter scheme, the rest the full words). change_color is a neat roulette - Colored, Monochrome, or Limited Palette (which appends (limited_palette:1.3)) - handy when you're trying to see how a model handles backgrounds.

    The seed input is worth understanding, because it's the thing that makes this repeatable. Page and post selection are both derived deterministically from it, so the same seed against the same page gives the same pick. Note that max_pages defaults to 0 - which means page 0, the newest posts, every time. If you want actual variety across the booru's history, bump max_pages up (say 20–50); with the default you're just sampling the front page.

    Inputs and outputs that matter

    • booru - nine options: gelbooru (default), rule34, safebooru, danbooru, konachan, yande.re, aibooru, xbooru, e621.
    • tags - optional comma-separated tags to search by, e.g. 1girl, long hair. Leave empty for pure random.
    • seed - makes the pick deterministic per run.
    • use_last_prompt - freeze the last result instead of re-rolling.
    • return_picture - fetch the actual image, not just the tags.

    Outputs are TAGS (STRING, your prompt), IMAGE (the picture as a tensor - a 1×1 black pixel if return_picture is off, so don't wire it blind), and IMAGE_URL (STRING, handy for logging or a save node).

    Installing it

    ComfyUI Manager, search "Ranbooru" (the pack is "Ranbooru for ComfyUI"), or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Inzaniak/comfyui-ranbooru
    

    Then restart ComfyUI. There's no requirements.txt - the pack only imports requests, torch, numpy and Pillow, all of which ComfyUI ships with, so install really is clone-and-restart. No model downloads.

    Common issues

    This node needs internet. If a booru returns a 403, that's the API key file calling: on first run the pack creates ranbooru.conf next to the node with empty key slots per booru. Most boorus work keyless for tag fetching, but danbooru and e621 are the strict ones - that's where credentials go.

    Every node in this pack reports IS_CHANGED as NaN, which is ComfyUI-speak for "always re-run me". So Ranbooru re-rolls on every queue run rather than caching - great for roulette workflows, and the reason use_last_prompt exists. Also worth knowing: booru tags are the vocabulary the whole anime SDXL line (Illustrious, NoobAI, Pony) was trained on, so the tag output is native to those models, but if you feed it to a 2026 LLM-encoded checkpoint, expect it to understand the words rather than the formatting.

    CategoryRanbooru Nodes

    Inputs (9)

    NameTypeDefaultDescription
    booruCOMBOgelbooru9 options: gelbooru, rule34, safebooru, danbooru, konachan, yande.re, +3
    max_pagesINT00–100
    posts_per_pageINT11–100
    seedINT00–18446744073709550000
    tagsSTRING
    ratingCOMBOAll5 options: All, Safe, Sensitive, Questionable, Explicit
    change_colorCOMBODefault4 options: Default, Colored, Limited Palette, Monochrome
    use_last_promptBOOLEANfalse
    return_pictureBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    TAGSSTRING
    IMAGEIMAGE
    IMAGE_URLSTRING