Nodes/nsfw-shorier_comfyui/Save Image (SFW)
ComfyUI Node

Save Image (SFW)

Save a file, and black out anything NSFW before it touches disk

By phyblas·Created 12 months ago·Updated 4 months ago· 17
Save Image (SFW)
  • image
    filename_prefixComfyUI
    file_type
    no_metadatafalse
    nsfw_detector_model
    threshold0.50

    SaveImageSfw is the pack's paranoia button: a drop-in replacement for ComfyUI's core SaveImage that runs a detector on every frame and writes flagged images to disk as plain black. Clean images save normally. It's adapted from comfyui-saveimage-plus, and it exists for the workflows where you can't eyeball every output but you still want the files to survive someone else's glance. Automate a batch, walk away, and the disk stays presentable.

    How it works

    The inputs are mostly what you'd expect from a save node - filename_prefix (default "ComfyUI"), file_type (png, jpg, or webp), and no_metadata (off by default). Then the NSFW half: nsfw_detector_model (the usual eight-option dropdown, compvis default) and threshold (default 0.5).

    One detail worth knowing: the metadata handling follows core ComfyUI's conventions - PNG files get the prompt and workflow embedded in PNG text chunks, and jpg/webp store it in EXIF user comments, unless no_metadata is on. So you don't lose the workflow-included culture just because you're saving jpg.

    A genuinely useful trick: set threshold to 1 and the detector never fires, so every image saves untouched. It turns SaveImageSfw into a plain SaveImage with extra file formats - handy if you already have a censor node upstream and just want the save behavior.

    Outputs

    None - it's an output node, the last stop on the graph. It returns the standard images UI result (filename, subfolder) that ComfyUI's gallery reads.

    Install

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

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

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

    Gotchas

    • The "black box" is the whole point: anything flagged saves as a solid black image, and there's no way to recover it afterward. If you might want the original later, save a separate copy with core SaveImage.
    • threshold 1 = disable detection. Keep that in your back pocket.
    • Different detectors score on different scales - if you switch models, re-tune the threshold or you'll get a run of black files.
    Categoryimage

    Inputs (6)

    NameTypeDefaultDescription
    imageIMAGE
    filename_prefixSTRINGComfyUI
    file_typeCOMBO3 options: png, jpg, webp
    no_metadataBOOLEANfalse
    nsfw_detector_modelCOMBO8 options: compvis, falconsai, adamcodd, umairrkhn, marqo, gantman, +2
    thresholdFLOAT0.500–1

    Outputs (0)

    No outputs