Nodes/nsfw-shorier_comfyui/Filter NSFW with text
ComfyUI Node

Filter NSFW with text

The same censor, but it stamps 'NSFW' across the image

By phyblas·Created about a year ago·Updated 6 months ago· 18
Filter NSFW with text
  • image
  • image
  • NSFW
  • score
◄model_name▾►
◄threshold0.50►
◄mode▾►
◄resolution8►
◄textNSFW►
◄font_size120►
◄fill_color#FFFFFF►
◄stroke_color#FF0000►
◄stroke_width0.20►
◄fontArial►

FilterNsfwWithText is FilterNsfw with a label on top. Same detection, same eight processing modes, same threshold - but any frame the detector flags also gets text stamped across it, centered, by default the word "NSFW" in white with a red outline. If you're building a pipeline where censored output needs to be obviously censored - a content-moderation dump, a preview feed, a "blocked content" placeholder - this saves you from a second node doing the labeling.

How it works

The detection and mode/resolution inputs behave exactly like FilterNsfw. The new stuff is the text layer:

  • text (multiline, default "NSFW") - what gets stamped
  • font_size (default 120)
  • fill_color (default #FFFFFF) and stroke_color (default #FF0000) - the classic white-on-red-outline warning look
  • stroke_width (0–1, default 0.2) - how bold the outline is
  • font (default "Arial") - the font file name

The text is centered and drawn with stroke, so it stays legible over a blur. The feature is adapted from the ComfyUI-TextOverlay pack, and so is the font handling.

The font gotcha

This is where people actually get stuck. Pillow needs a real font file, and "Arial" isn't guaranteed to exist on your OS - Linux boxes in particular often don't have it. The node looks in two places first: this pack's font/ folder (it ships with a Chinese font, 字魂手刻宋.ttf) and the fonts/ folder of ComfyUI-TextOverlay if you've installed that pack. The fix is easy: drop any .ttf or .ttc into ComfyUI/custom_nodes/nsfw-shorier_comfyui/font/ and type its filename into the font field. Use a bold font and a thick stroke or the text vanishes into a busy image.

Outputs

Same triple as FilterNsfw: image (censored + stamped), NSFW (BOOLEAN), and score (FLOAT). The verdict and score pass through so you can still branch or log after the fact.

Install

ComfyUI Manager (search "nsfw-shorier") or:

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

Restart, first run downloads the detector. If the text doesn't render, it's almost always the font - check the font field before anything else.

CategoryNSFW

Inputs (11)

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—
textSTRINGNSFW—
font_sizeINT1201–9999—
fill_colorSTRING#FFFFFF—
stroke_colorSTRING#FF0000—
stroke_widthFLOAT0.200–1—
fontSTRINGArial—

Outputs (3)

NameTypeDescription
imageIMAGE—
NSFWBOOLEAN—
scoreFLOAT—