CompVis Safety Checker
The infamous 'black image' NSFW filter, now as a node you opt into
- image
- STRING
- IMAGE
If you've ever generated an image with an early Stable Diffusion pipeline and gotten back a solid black square, this node is the reason why. CompVis/stable-diffusion-safety-checker is the CLIP-based NSFW filter that shipped bolted onto every early SD release, the one half the community immediately learned to disable because it flagged perfectly tame images along with the actual nudity. CompVisSafetyChecker takes that exact model and wraps it as a ComfyUI node - so instead of it silently gatekeeping you inside someone else's pipeline, you decide where it sits in your graph and whether it runs at all.
Where this earns a real place: automated moderation. If you're running a workflow that serves generations somewhere other than your own screen - a Discord bot, a shared gallery, an app with users you don't personally vet - you want an automatic "don't ship this" gate before the output reaches anyone. That's the job here. One thing worth being upfront about, because someone on r/comfyui asked for exactly this and got redirected here before realizing it didn't fit: this checks images, not prompts. If what you actually need is to stop people from asking for something (CP, real-person likeness, that category of problem), this node won't help - it only ever looks at pixels after they're already generated.
How it works
The model encodes your image with CLIP and compares that embedding against a small, fixed set of "unsafe concept" embeddings baked into the checkpoint - the same mechanism the original Stable Diffusion release used. If the similarity to any of those concepts clears a threshold, the image gets flagged.
The inputs and outputs that matter
image(IMAGE) - what gets checked.model_name- a dropdown populated from whatever's sitting in yourmodels/diffusersfolder. It's empty until you've downloaded the checkpoint (see install below) - don't panic if you add the node and see nothing to pick from.safety_threshold(default-0.028, range-1to1) - how trigger-happy the filter is. This is almost certainly wired to the same "adjustment" value the stock diffusers checker exposes, where the code comment literally says increase this to create a stronger filter, at the cost of flagging more benign images. If that's right, nudging it up makes it stricter; nudging it down loosens it. Notice the default here sits below diffusers' stock0.0- a deliberately looser starting point, which tracks with how much grief that default setting caused people historically.
Outputs: a STRING (the verdict) and an IMAGE - the same image passed through, blacked out if it got flagged. Wire the IMAGE into your SaveImage/PreviewImage, and branch on the STRING if you want your workflow to actually do something different (skip a webhook, log it, whatever) when content gets caught.
How to install it
Via ComfyUI Manager: search ComfyUI Safety Checker, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/shabri-arrahim/ComfyUI-Safety-Checker
cd ComfyUI-Safety-Checker
pip install -r requirements.txt
Then the part people skip: download the actual model and put it where the node expects it.
huggingface-cli download CompVis/stable-diffusion-safety-checker \
--local-dir models/diffusers/CompVis_stable_diffusion_safety_checker
Restart ComfyUI after that so the model_name dropdown actually has something in it.
Common issues & troubleshooting
model_name dropdown is empty. You skipped the huggingface-cli download step, or the folder isn't named/placed the way the README specifies. It has to land inside models/diffusers/, not just anywhere under models/.
Everything gets flagged, including obviously safe images. This is the model's actual, well-documented reputation - it's the same checker that got mocked for years for over-blocking. Push safety_threshold down a bit rather than assuming your workflow is broken.
You wanted to block prompts, not images. This node can't do that - it has no visibility into your prompt text at all, only the rendered pixels. That's a different problem needing a different tool (prompt-side keyword/embedding filtering, done before generation even starts).
Nothing shows up under "SafetyChecker" in the node search. Confirm the install actually landed in custom_nodes/ and that you restarted rather than just refreshing the browser tab - ComfyUI only registers new custom nodes at process start.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | 0 options: | |
| image | IMAGE | — | |
| safety_threshold | FLOAT | -0.028-1–1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| IMAGE | IMAGE | — |