Nodes/ComfyUI-Danbooru-Gallery/角色特征交换 (Character Feature Swap)
ComfyUI Node

角色特征交换 (Character Feature Swap)

Transplant one character's hair, eyes, and body shape onto a different prompt

By Aaalice233·Created 11 months ago·Updated 24 days ago· 224
角色特征交换 (Character Feature Swap)
    • new_prompt
    original_prompt
    character_prompt
    target_featureshair style, hair color, hair ornament, eye color, unique body parts, body shape, ear shape

    Keeping a specific character's look consistent across different scenes and poses is, by a wide margin, the most-discussed unsolved problem in this whole space - ask anyone what they struggle with most and this is usually the answer. Character Feature Swap is a small, targeted prompt-text tool aimed at one slice of that problem: taking a base scene prompt and deliberately overwriting just the physical-feature words with a different character's, rather than hoping the model keeps them straight on its own.

    What it does

    Three string inputs go in: original_prompt (your base scene - pose, setting, action, whatever), character_prompt (a description of the character whose features you want to borrow), and target_features - a plain comma list naming which categories of feature actually get swapped. The default list is telling: hair style, hair color, hair ornament, eye color, unique body parts, body shape, ear shape - exactly the identity-defining attributes that tend to blend or drift between prompts, rather than pose or clothing, which usually aren't what people mean by "character consistency" anyway. One string comes out: new_prompt, the merged result.

    The pack doesn't publish exactly how the swap logic works under the hood, but the shape of the fields tells you the intent clearly enough: it's a targeted find-and-replace-and-merge, not a full rewrite. Only the feature categories you list get pulled from character_prompt; everything else in original_prompt - the scene, the pose, the setting - is meant to survive untouched.

    Why this matters more than it sounds

    The reason character consistency is hard isn't that models can't render a character well once - it's that every generation is stochastic and independent, with no memory of what it just made. When you're deliberately combining two prompts (a scene and a character reference) rather than generating one character over and over, the risk shifts: instead of "did this character drift from the last image," it becomes "did the model correctly apply this character's traits instead of inventing its own or blending the two." A node that explicitly names which attributes to transplant is a more surgical answer to that than just concatenating two prompts and hoping the model sorts it out - which is exactly the kind of attribute-bleeding failure that shows up whenever two character descriptions end up in the same prompt.

    The inputs and outputs that matter

    • original_prompt (required, STRING) - your base scene prompt.
    • character_prompt (required, STRING) - the character description to pull features from.
    • target_features (required, STRING, default hair style, hair color, hair ornament, eye color, unique body parts, body shape, ear shape) - which feature categories actually get swapped. Trim this list down if you only want, say, hair and eye color transplanted and nothing else touched.
    • Output: new_prompt (STRING) - wire straight into your text encoder.

    How to install it

    ComfyUI Manager: search "ComfyUI-Danbooru-Gallery", install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Aaalice233/ComfyUI-Danbooru-Gallery.git
    cd ComfyUI-Danbooru-Gallery
    pip install -r requirements.txt
    

    Restart ComfyUI. No model downloads for this one - it's a text-processing node.

    Common issues & troubleshooting

    Swapped result doesn't look like a clean swap. Since the exact matching logic isn't documented, treat target_features as a hint list rather than a guarantee - if a feature category doesn't cleanly match how it's phrased in either prompt (different wording for the same idea, or a feature described across multiple tags), the swap for that category may not land the way you expect. Keep both prompts in similar phrasing style (tag-style vs. sentence-style) for the most predictable results.

    You want more than physical features swapped. This node is explicitly scoped to appearance features per its default list - it's not meant for swapping pose, outfit, or setting. For putting two distinct characters in one scene without either bleeding into the other, this pack's Multi Character Editor node is the more relevant tool.

    Node doesn't show up in the menu. Standard pack-load check: confirm the repo path, confirm dependencies installed, check the ComfyUI console at startup for an import error.

    Categorydanbooru

    Inputs (3)

    NameTypeDefaultDescription
    original_promptSTRING
    character_promptSTRING
    target_featuresSTRINGhair style, hair color, hair ornament, eye color, unique body parts, body shape, ear shape

    Outputs (1)

    NameTypeDescription
    new_promptSTRING