Nodes/petty-paint-comfyui-node/Petty Paint Remove Add Text
ComfyUI Node

Petty Paint Remove Add Text

Strip junk tags and bolt on new ones without a single regex

By mephisto83·Created 2 years ago·Updated 2 years ago· 3
Petty Paint Remove Add Text
    • STRING
    text
    remove
    add

    You've got a prompt string full of stale tags, and you want specific chunks gone and a couple of terms added to the end. That's the whole job of Petty Paint Remove Add Text: surgical string editing for prompts, no regex knowledge required. It's one of those nodes you glance at and think "I could do this with any text-tools pack," and then realize it's already on your machine because it ships in the petty-paint bundle and uses the same semicolon conventions as the rest of the pipeline.

    How it works

    The mechanism is plain Python string surgery, and it's worth knowing exactly what it does before you trust it. The remove and add fields are each split on semicolons. Every item in remove is then deleted via str.replace(item, '') - which means each substring disappears everywhere it appears, not just at the start of the string. Then each non-empty item in add is appended as , item, so your additions come out comma-separated and ready to drop straight into a positive prompt.

    Because it's replace and not regex, a remove of cat will also eat cats, concatenate, and catwalk. For tag cleanup that's usually exactly what you want - you're stripping whole tokens like blurry;lowres - but keep it in mind with short words. And the separator is the author's convention: feed it a comma-separated list and nothing gets split.

    The inputs that matter

    • text - the string you're editing. It's forceInput, so you wire it in rather than type.
    • remove - substrings to delete, semicolon-separated, one per line if you like.
    • add - terms to append at the end, semicolon-separated.

    The single STRING output feeds anywhere a prompt string goes: CLIPTextEncode, another text node, or a PettyPaintTexts_to_Conditioning list if you're encoding a batch.

    Where it fits

    In the petty-paint world this exists because the iPad app hands you prompt blobs you want to normalize before they hit conditioning - strip the tags that came with the last setup, add your current ones. Standalone, it's a decent little cleanup node, though if you need fuzzy matching or case-insensitive replacement you'll outgrow it fast and want a proper regex node instead.

    Installing it and when it bites you

    Install once with the pack - ComfyUI Manager search "Petty Paint", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mephisto83/petty-paint-comfyui-node
    

    then restart. No models to download and no heavy dependencies (the pinned Flask isn't even imported by the current source).

    The failure modes are all string-semantics shaped: semicolons instead of commas, remove matching inside other words, and - the classic - an empty add term that leaves a trailing , on your prompt because every item gets , item appended even when a line is blank. That last one's mostly cosmetic, but it can trip up prompt parsers. If your output prompt looks off, check for it.

    CategoryPettyPaint

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    removeSTRING
    addSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING