Nodes/WDanbooru Injector/🌸 WDanbooru Injector
ComfyUI Node

🌸 WDanbooru Injector

Paste a booru post ID, get a prompt Anima actually understands

By Winnougan·Created 4 months ago·Updated 4 months ago· 1
🌸 WDanbooru Injector
    • positive_prompt
    • injected_tags_only
    sourcegelbooru
    post_id
    inject_modeprepend
    quality_prefixmasterpiece, best quality, score_7
    safety_tagsafe
    year_tagnone
    include_artisttrue
    include_charactertrue
    include_copyrighttrue
    include_generaltrue
    max_general_tags40
    positive_prompt
    manual_tags
    count_tag
    gelbooru_user_id
    gelbooru_api_key
    e621_username
    e621_api_key
    danbooru_username
    danbooru_api_key
    extra_tags

    You see a post you like, and you want to riff on it - the pose, the framing, the style. If you're on Anima or any Danbooru-trained model, the honest way to do that is to reproduce the post's tag structure. Retyping forty tags by hand is miserable. This node fetches them for you: paste a booru post ID or URL, and it pulls the tags straight from the site's API, rebuilds them into a properly ordered prompt, and merges that into whatever you already had.

    The name isn't a metaphor. It injects.

    How it works

    The WDanbooru Injector hits one of 13 sources - gelbooru, e621, danbooru, konachan.net, konachan.com, yande.re, lolibooru, safebooru, rule34, hypnohub, atfbooru, xbooru, or a fully offline manual mode - and fetches the post's tags. Where the API separates categories (e621 and Danbooru do), it splits tags into artist, character, copyright, and general; the flat boorus just dump everything into general. Then it assembles them in Anima's recommended order:

    [quality] [year] [safety] [count] [character] [copyright] [@artist] [general]
    

    Underscores become spaces, and artist tags get the @ prefix Anima wants. The whole point of that ordering is that the models you're using were trained on exactly this vocabulary - a correctly ordered tag string beats a sentence for control, and Anima's card spells this order out almost verbatim.

    The inputs that matter

    • source - which booru to fetch from.
    • post_id - a plain number or the post's page URL. Don't paste the direct image URL; there's no post ID in it, and the node will tell you so.
    • inject_mode - prepend (tags before your prompt), append (after), or replace (your prompt gets thrown away).
    • safety_tag - the rating tag. Note the default is safe, so if your source post is explicit and you want that reflected, set it (or none).
    • The four include toggles and max_general_tags (default 40) - trim the noise. Artist, character, and copyright toggles let you keep just the parts you want.

    The optional inputs are where it gets useful: positive_prompt is your existing prompt to merge with, count_tag adds the character count (1girl, 2boys), extra_tags appends whatever you always want in there, and the gelbooru_user_id / gelbooru_api_key / e621_username / danbooru_api_key fields carry your credentials. The default quality prefix is masterpiece, best quality, score_7 - Anima's recommended opener. Score tags are the model's own quality dial, and if you're chasing a specific artist style you can drop the prefix entirely and let the @artist tag carry it.

    Outputs

    positive_prompt is the full merged string - wire it to your CLIP Text Encode positive input and you're done. injected_tags_only is the fetched block by itself, before your base prompt gets mixed in; it exists for debugging, and you'll be glad it does the first time a prompt comes out weird.

    Installing it

    ComfyUI Manager, search WDanbooru_Injector, install, restart. Manual, if that's your style:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Winnougan/WDanbooru_Injector.git
    

    Restart and you'll find it under WDanbooru. The only dependency is requests (already in ComfyUI), so no model downloads and no surprises.

    Common gotchas

    Gelbooru flat-out requires a free-account API key - every request, no exceptions - and the node raises a clear error telling you where to get it. e621 wants your username in its requests (their API policy), so fill e621_username or expect 403s. The node accepts credentials raw or with the key= prefixes stripped, so pasting the whole copied string works either way. And when all you want is no network at all - say, testing the tag ordering - switch source to manual and paste tags into manual_tags; no API call happens.

    CategoryWDanbooru

    Inputs (21)

    NameTypeDefaultDescription
    sourceCOMBOgelbooru13 options: gelbooru, e621, danbooru, konachan.net, konachan.com, yande.re, +7
    post_idSTRING
    inject_modeCOMBOprepend3 options: prepend, append, replace
    quality_prefixSTRINGmasterpiece, best quality, score_7
    safety_tagCOMBOsafe5 options: safe, sensitive, questionable, explicit, none
    year_tagCOMBOnone7 options: none, 2020, 2021, 2022, 2023, 2024, +1
    include_artistBOOLEANtrue
    include_characterBOOLEANtrue
    include_copyrightBOOLEANtrue
    include_generalBOOLEANtrue
    max_general_tagsINT401–200
    positive_promptoptSTRING
    manual_tagsoptSTRING
    count_tagoptSTRING
    gelbooru_user_idoptSTRING
    gelbooru_api_keyoptSTRING
    e621_usernameoptSTRINGYour e621 username. Required for API access (e621 policy).
    e621_api_keyoptSTRINGOptional e621 API key for higher rate limits. Get at e621.net → Account → Manage API Access.
    danbooru_usernameoptSTRINGYour Danbooru username. Optional for public posts.
    danbooru_api_keyoptSTRINGOptional Danbooru API key.
    extra_tagsoptSTRING

    Outputs (2)

    NameTypeDescription
    positive_promptSTRING
    injected_tags_onlySTRING