Keyword Image Blocker
A dumb little gate that stops the wrong image from ever being saved
- image
- IMAGE
Keyword Image Blocker is a tripwire for your own output. You put it between VAE Decode and Save Image, give it a list of words, and any image whose tags match one of those words gets swapped for a plain warning.png before it ever hits disk. It's not moderation, it's not clever - it's a dead-simple "please don't save that" that sits on your machine and does exactly one job. For unattended batch runs, a shared box, or just protecting your own sanity from the occasional generation that goes somewhere you didn't ask it to, that's genuinely useful.
The one thing it is not is an image tagger. The name makes it sound like it sees pixels; it doesn't. It reads text. So the first thing to know is that this node only works if you wire in a separate tagger like WD14 Tagger (pysssss's custom node with the wd-v1-4-moat-tagger-v2 model) to label your decoded image first. Tag the image, feed those tags in, and let this node be the bouncer.
How it works
The logic is all string matching, and it's worth reading the syntax because it's the whole game. You write your blocklist in the keywords box, comma-separated. Each entry is checked as a case-insensitive substring against the lowercased tag text. Two extra operators: / is OR, + is AND. So nude, boob+nipple, penis means "block if the word nude appears, or if both boob and nipple appear, or if penis appears." The author's own example - boobs/boob+nipple/nipples - blocks if any of those words shows up, unless they're grouped by +, in which case both parts must match.
On a hit, the node loads assets/warning.png from its own folder, resizes it to match your biggest frame, and returns that single image. Your Save Image node happily writes the placeholder instead of whatever the model actually produced. Miss, and your image passes through untouched.
It also prints debug lines to the ComfyUI console - frame shapes, the parsed keyword list, whether it hit. Not a feature, but handy when it "isn't working" and you want to see what it actually read.
The inputs that matter
Three inputs, all required, none scary:
- image - your decoded image, straight out of VAE Decode.
- tags - the text output from your tagger. Wire the tagger's STRING output here.
- keywords - your blocklist, using the comma/
+//syntax above.
The single IMAGE output plugs into Save Image (or wherever you were sending the image before). That's the whole surface area - there are no optional inputs, no settings to tune.
Installing it
It's a one-node pack, and a light one at that. In ComfyUI Manager, search for "KeywordImageBlocker" and install; or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/JustLateNightAI/KeywordImageBlocker
Then restart ComfyUI. The pyproject.toml lists no dependencies at all - it only uses torch, PIL, and torchvision, which ComfyUI already ships. No models to download for this node. The actual download cost is the tagger on the other side of it: WD14 Tagger pulls a ~200MB WD14 model, so don't blame this pack for that.
Gotchas
The biggest trap is substring matching: ass matches classic, and art matches start. Keep your keywords long enough to be unambiguous, or you'll start blocking things you didn't mean to. Second trap: it's a post-generation gate. The image is fully decoded before the blocker sees it - this won't stop an expensive generation, it only stops the save. If you want to abort early, this isn't that tool. And since it trusts the tagger's output entirely, a tagger that misses a tag lets that image through. It's a reasonable tripwire, not a guarantee.
Want a different placeholder? Replace warning.png in the pack's assets/ folder with your own image of the same name. It's about as deep as the customization goes - which, for a node this focused, is the right amount.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| tags | STRING | Plug a image tagger like WD14 into this box | — |
| keywords | STRING | List the tags you want to filter for and block in this text box, ie nude, penis, naked, ect | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |