Nodes/Bjornulf_custom_nodes/๐Ÿ”€๐ŸŽฒ Text scrambler (๐Ÿง‘ Character)
ComfyUI Node

๐Ÿ”€๐ŸŽฒ Text scrambler (๐Ÿง‘ Character)

Mutate one good sentence instead of writing ten

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
๐Ÿ”€๐ŸŽฒ Text scrambler (๐Ÿง‘ Character)
    • STRING
    โ—„textphotography portrait of a happy middle-aged swedish woman nurse with a fit body, wearing a black headband, large blue parka and orange jeans.โ–บ
    โ—„seed0โ–บ
    โ—„image_stylesfalseโ–บ
    โ—„agesfalseโ–บ
    โ—„sexfalseโ–บ
    โ—„body_typesfalseโ–บ
    โ—„colorsfalseโ–บ
    โ—„emotionsfalseโ–บ
    โ—„nationalitiesfalseโ–บ
    โ—„clothing_headfalseโ–บ
    โ—„clothing_topfalseโ–บ
    โ—„clothing_bottomfalseโ–บ
    โ—„occupationsfalseโ–บ
    โ—„sizesfalseโ–บ
    โ—„image_typesfalseโ–บ

    Different animal from the pack's Text Generator nodes, which build a character description from scratch category by category. This one takes a sentence you've already written - the default input is a full portrait prompt, something like "photography portrait of a happy middle-aged swedish woman nurse with a fit body, wearing a black headband, large blue parka and orange jeans" - and randomly swaps out the words that fall into whichever categories you've turned on. You keep the sentence structure you liked, and just get variation on the details.

    How it works

    Under the hood it's matching against a JSON file - scrambler/character_scrambler.json, sitting in the pack's own folder - that maps out category word-lists: colors, emotions, nationalities, clothing pieces, and so on. Turn on a category with its boolean toggle and the node looks for words in your input text that belong to that category, then replaces them with a random pick from the same list, seeded by the seed value so you can reproduce a specific scramble or roll a new one by changing the seed. Leave a category off and words that would match it are left untouched. Because the file is plain JSON sitting in your install, you can open it and edit the word lists if the built-in options don't cover what you want.

    The inputs and outputs that matter

    • text (STRING, multiline) - the base sentence to scramble. Comes with a full example prompt pre-filled so you can see the intended format.
    • seed (INT) - controls which random substitutions get picked; same seed, same result.
    • A stack of optional booleans, all off by default: image_styles, ages, sex, body_types, colors, emotions, nationalities, clothing_head, clothing_top, clothing_bottom, occupations, sizes, image_types - flip on whichever categories you want randomized; the rest of the sentence stays as written.
    • Output: STRING - the scrambled sentence, ready to feed straight into your prompt encoder or a Show node to check it first.

    How to install it

    Via ComfyUI Manager: search Bjornulf_custom_nodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    cd Bjornulf_custom_nodes && pip install -r requirements.txt
    

    then restart ComfyUI. No special dependency for this node specifically, but the shared requirements.txt for the whole pack still gets pulled in.

    Common issues & troubleshooting

    Nothing changes when you run it. If every category toggle is off, the node has nothing to substitute and just passes the sentence through unchanged. Turn on at least one category boolean.

    A category is on but nothing in that category changes. The substitution only works on words the JSON word-list actually recognizes - if your sentence phrases something in a way the list doesn't match (a color described unusually, say), it won't get swapped. Check scrambler/character_scrambler.json in the pack's install folder to see exactly what it's matching against, and add to it if you need more coverage.

    Same seed, different-looking result across runs. Changing which categories are enabled changes what the node is scrambling, even at the same seed - the seed controls the random picks within whatever categories are active, not a global lock on the whole output. If you want a fully reproducible result, keep both the seed and your toggle selection fixed.

    CategoryBjornulf

    Inputs (15)

    NameTypeDefaultDescription
    textSTRINGphotography portrait of a happy middle-aged swedish woman nurse with a fit body, wearing a black headband, large blue parka and orange jeans.โ€”
    seedINT0โ€”
    image_stylesoptBOOLEANfalseโ€”
    agesoptBOOLEANfalseโ€”
    sexoptBOOLEANfalseโ€”
    body_typesoptBOOLEANfalseโ€”
    colorsoptBOOLEANfalseโ€”
    emotionsoptBOOLEANfalseโ€”
    nationalitiesoptBOOLEANfalseโ€”
    clothing_headoptBOOLEANfalseโ€”
    clothing_topoptBOOLEANfalseโ€”
    clothing_bottomoptBOOLEANfalseโ€”
    occupationsoptBOOLEANfalseโ€”
    sizesoptBOOLEANfalseโ€”
    image_typesoptBOOLEANfalseโ€”

    Outputs (1)

    NameTypeDescription
    STRINGSTRINGโ€”