ComfyUI Node

Filter NSFW

Blur it, mosaic it, or black it out — the all-purpose censor

By phyblas·Created 12 months ago·Updated 4 months ago· 17
Filter NSFW
  • image
  • image
  • NSFW
  • score
model_name
threshold0.50
mode
resolution8

FilterNsfw is the censor workhorse of this pack. It's IsNsfw's detection plus an actual reaction: when the detector says an image is NSFW, the node applies one of eight treatments to it instead of just flagging it. Feed it a batch and it goes frame by frame - clean images pass through untouched, flagged ones get processed. That's the behavior you want when a workflow has to output something presentable no matter what.

How it works

Detection is the same as the rest of the pack: model_name (default compvis) plus a threshold (default 0.5, lower = more trigger-happy). Then comes mode, where the real decisions happen:

  • blur - soft Gaussian-ish downscale-blur
  • mosaic - the classic pixel block look
  • black / white - just fill it in
  • checker - black-and-white checkerboard
  • mean - fill with the image's average color
  • noise - random static
  • nsfw-chan - replace the image with the pack's own mascot (yes, really)

resolution (default 8) controls the coarseness of the effect. For mosaic it's the block size - 8 gives chunky pixels, crank it to 32 and it's unreadable. For blur it's the blur intensity. Lower values are subtler, which is usually not what a censor wants.

Outputs

  • image (IMAGE) - the processed result, whether censored or untouched
  • NSFW (BOOLEAN) - pass-through verdict, handy for branching downstream
  • score (FLOAT) - the raw detector score behind it

So it both fixes the frame and tells you it fixed it. If you want to log or count how often things got censored, those two extra outputs are right there.

Install

Same pack, same drill - ComfyUI Manager (search "nsfw-shorier") or:

cd ComfyUI/custom_nodes
git clone https://github.com/phyblas/nsfw-shorier_comfyui

Restart, and expect a slow first run while the detector downloads.

Gotchas

  • Threshold tuning matters twice here: too low and you blur a bunch of innocent frames; too high and the thing you were trying to hide sails through.
  • The mode applies to whole images only. If you want to censor just the flagged regions and leave the rest of the art alone, that's CensorNsfwPart - same pack, same modes, but it localizes with NudeNet first.
  • If you're censoring anime, the photo-trained detectors will both miss things and over-flag; budget for manual review.
CategoryNSFW

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
model_nameCOMBO8 options: compvis, falconsai, adamcodd, umairrkhn, marqo, gantman, +2
thresholdFLOAT0.500–1
modeCOMBO8 options: blur, mosaic, black, white, checker, mean, +2
resolutionINT82–256

Outputs (3)

NameTypeDescription
imageIMAGE
NSFWBOOLEAN
scoreFLOAT