Nodes/comfyui-watermark-remover/Watermark Sentence Remover 🧹
ComfyUI Node

Watermark Sentence Remover 🧹

It Removes 'Watermark' From Text Files, Not Your Images — and That's Fine

By Slartibart23·Created 6 months ago·Updated 6 months ago· 0
Watermark Sentence Remover 🧹
    • status_message
    • files_processed
    • sentences_removed
    input_folder
    output_folder
    dry_runfalse
    case_sensitivefalse

    Let's get the disappointment out of the way up front: the name is a lie in a very specific direction. This node does not scrub logos off images, and it calls no API and needs no model. It reads every .txt file in a folder, deletes any sentence containing the word "Watermark," and writes the cleaned files out to another folder. That's the whole job. It is the least ambitious "AI removal" tool you will ever install - it deletes the word, not the logo.

    Which is exactly what you want when your problem is a folder full of captions. If you've ever pulled a dataset for LoRA training or a bundle of Civitai-style sidecar text files and found every one of them peppered with "This image contains a watermark from Example Corp." boilerplate, you know the chore: open each file, find the offending sentence, delete it, save. This node turns that into one click, with a status message telling you how many files it touched and how many sentences died.

    How it works

    Drop it in a graph, give it two folder paths, hit run - it's an output node, so it needs no wires and produces nothing visual. Under the hood (the source is plain stdlib Python, no dependencies) it:

    1. Globbed all *.txt files in the input folder - top level only, no recursion, no other extensions.
    2. Reads each file as UTF-8, falling back to latin-1 if a decode fails.
    3. Splits the text into sentences on periods, while carefully protecting dots inside URLs and abbreviations like example.com so a URL inside a watermark sentence doesn't get chopped in half.
    4. Drops any sentence containing Watermark as a whole word, matched case-insensitively by default.
    5. Re-joins what's left, collapses double spaces, and writes the result to the output folder with the original filename, creating that folder if it doesn't exist.

    That case-insensitive whole-word match matters. It catches watermark, Watermark, and WATERMARK - but it also catches "this image has no watermark". Negative statements die too. If your captions say things like "watermark-free render," you'll lose more than you bargained for. That's why dry_run exists: flip it on and it analyzes without writing a single file, so you can sanity-check the counts before committing. On a folder you're about to feed into a LoRA run, that preview is not optional.

    The inputs that matter

    • input_folder / output_folder - the only required inputs, plain full paths. Set both.
    • dry_run - analyze without writing. Do this first.
    • case_sensitive - on, only capital-W "Watermark" matches; off (default), any case.

    Outputs are status_message (a multi-line human-readable summary), files_processed (INT), and sentences_removed (INT). They're informative more than useful - you can wire status_message into a text preview node if you want to read it in the UI, but the real result is the files on disk.

    Installing it

    ComfyUI Manager is the easy path - search "comfyui-watermark-remover" and install, or clone it manually:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Slartibart23/comfyui-watermark-remover
    

    Restart ComfyUI and it appears under text › processing as "Watermark Sentence Remover 🧹." No requirements.txt to fight, no models to download, nothing to version-match. The README calls for Python 3.13+, but the code is plain modern Python - if your ComfyUI runs at all, this will almost certainly run. After the dependency hell the ecosystem is famous for, a custom node this clean installs like a sigh of relief.

    Where people get burned

    • The sentence rule is period-only. A sentence ending in ? or ! doesn't count as one - so "Where's the watermark! This is clean." is treated as one block, and the clean half gets deleted along with the offending half. If your text has watermark mentions mid-exclamation, pre-check with dry run.
    • It's not recursive. Files in subfolders are ignored.
    • Whole sentences go, not the word. "Contains a watermark from Example Corp." vanishes entirely; you don't get a sentence with a hole in it.

    For a single narrow job, this node is done well: no bloat, honest outputs, and a dry-run mode that most folder-hammering tools forget. Just don't ask it to clean up an actual PNG.

    Categorytext/processing

    Inputs (4)

    NameTypeDefaultDescription
    input_folderSTRING
    output_folderSTRING
    dry_runoptBOOLEANfalse
    case_sensitiveoptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    status_messageSTRING
    files_processedINT
    sentences_removedINT