ComfyUI Node

NSFW Filter

The old CompVis safety checker as a drop-in blur node

By Acly·Created 3 years ago·Updated about a month ago· 667
NSFW Filter
  • image
  • image
sensitivity0.5

This is the one node in the ComfyUI Nodes for External Tooling pack that isn't really about plumbing. Everything else in Acly's pack exists to shuttle images in and out of ComfyUI for an external app; this one is a content gate. If you're building a tool on top of ComfyUI - a Discord bot, a web app, anything strangers can hit - and you need a rough "don't return explicit images" screen, this is a two-wire way to bolt one on.

Under the hood it's the Safety-Checker - yes, that one, the CLIP-based classifier that shipped with the original Stable Diffusion and that half the community's first move was to rip out. Acly wrapped it in a node. It doesn't reject anything or throw an error; images that fail the check just come out blurred so the contents are obscured. That makes it safe to drop inline: your workflow always produces an image, it's just a frosted-glass version when the classifier trips.

How it works

You feed it a generated image, it runs the image through the safety-checker model, and if the score crosses your threshold it blurs the whole frame before passing it on. The model gets downloaded on first use, so your very first run with this node in the graph will stall for a bit while it pulls the weights - that's expected, not a hang. After that it's cached.

Worth being clear-eyed about what this is. The CompVis checker is a 2022 model with a real false-negative rate. Acly says so himself in the README: "the filter isn't perfect. Some explicit content may slip through." Treat it as a coarse safety net for a public surface, not a compliance guarantee. It's the kind of thing that catches the obvious stuff and misses edge cases, which is genuinely useful for a hobby tool and genuinely not enough for anything with legal weight.

The inputs and outputs that matter

There are only two inputs, and one of them you'll actually touch:

  • image (IMAGE) - the picture to screen. Wire your VAE Decode (or whatever produces the final image) into this.
  • sensitivity (FLOAT, default 0.5, range 0–1) - the threshold. Per the README, 0.5 catches explicit content only; push it to 0.7 and up to also catch partial nudity. Higher = more trigger-happy, so expect more false blurs on borderline-safe images as you raise it.

The single output is image (IMAGE) - the original if it passed, a blurred copy if it didn't. Because the shape is identical either way, you wire it straight into a Save Image, a Preview, or one of this pack's send-image nodes exactly as you would the raw output. Nothing downstream needs to know a filter is in the path.

How to install it

The whole pack installs in one shot. Easiest route is ComfyUI Manager: open it, search the pack title ComfyUI Nodes for External Tooling, install, restart. Or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-tooling-nodes.git

then restart ComfyUI. The pack itself is dependency-light, but this node is the exception that pulls a model - budget the one-time safety-checker download the first time you run it.

Common issues & troubleshooting

First run hangs, then works. That's the model download. Watch the console; you'll see it fetching the safety-checker weights. It only happens once.

Stuff still gets through. Expected. Raise sensitivity toward 0.7+ to catch partial nudity, but understand you're trading false negatives for false positives, and the model's ceiling is the model's ceiling - a 2022 classifier is not going to be airtight. If you need real coverage, layer a second check.

Everything comes out blurred. Your sensitivity is cranked too high for your content, or you're testing on borderline images. Drop it back toward the 0.5 default and confirm the node is actually seeing the image you think it is.

Categoryexternal_tooling

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
sensitivityFLOAT0.50–1

Outputs (1)

NameTypeDescription
imageIMAGE