Ever used a bunch of wildcards and ended up with a result you didn’t want to explain to your roommates? I built a little workaround for that.
I took the logic we usually use for detection and repurposed it to keep my local generations under control. It’s a bit of a "hack," but it works for me and I figured some of you might find it useful too!
🛡️ NSFW Image Guard for ComfyUI
A lightweight, robust security node designed to filter and censor NSFW content in real-time. Perfect for creators who stream, work in public spaces, or want to organize their generations automatically.
Key Features
Flexible Censorship: Choose between Blur, a custom Image overlay, or a simple Black-Screen block.
Silent Logging: Automatically saves flagged original images to a dedicated folder (
output/nsfw_logs/) for private review.Detection Engine: Powered by standard detection and detailed segmentation models (e.g., for specific anatomy).
Console Feedback: Color-coded terminal logs provide instant status updates and alerts.
1. Setup
Install: Extract the folder
ComfyUI-NSFW-Guardinto yourComfyUI/custom_nodes/directory.
Models: Place your YOLO
.ptdetection or segmentation models inComfyUI/models/ultralytics/.(Recommended: Anime NSFW Detection/ADetailer All-in-One)
Custom Assets: (Optional) To use a custom warning, place an image named
stop.jpg(or.png/.webp) inside the node's folder.
2. How to Use
Wiring: Connect your image source (e.g., VAE Decode) to the images input. Route the IMAGE output to your Preview or Save nodes.
Model Selection: Choose your detection model from the model_name list.
Configuration: Adjust the threshold (sensitivity) and pick your preferred filter_mode.
3. Filter Modes
Blur: Applies a heavy Gaussian blur (radius 60). Keeps the color palette and composition visible while obscuring all details.
Custom_Image: Replaces the blocked image with your custom
stop.jpgfile.Black: Replaces the content with a solid dark frame and a red "NSFW CONTENT BLOCKED" warning.
4. Settings Explained
threshold:
0.35 - 0.45: High sensitivity; recommended for maximum safety.
0.60 - 0.80: Standard detection; reduces false positives.
Save: Toggles the background saving of flagged images to
output/nsfw_logs/.debug_mode: Toggles terminal notifications (Red for blocks, Green for status).
5. Terminal Feedback
🔴 [NSFW Guard] ALERT: NSFW content detected! Displays in red when a block occurs.
🟡 [NSFW Guard] WARNING: Triggered if "Custom_Image" mode is active but no
stop.jpgis found in the node directory.
100% success rate is technically impossible to guarantee.
VibeCoded.
So it can have Bugs.
Write me and i ask Gemini or Chatgpt to remove the bugor do it by yourself.

