Nodes/D2 Nodes ComfyUI/D2 Mosaic Filter
ComfyUI Node

D2 Mosaic Filter

Censor faces and plates without leaving ComfyUI

By da2el-ai·Created 2 years ago·Updated 5 days ago· 66
D2 Mosaic Filter
  • images
  • IMAGE
dot_size20
color_mode
opacity1.00
brightness0
invert_colorfalse

D2 Mosaic Filter applies the classic pixel-block mosaic to an image - the thing Japanese TV has been using to obscure faces for decades, and the thing you'll want when sharing a generation that accidentally rendered a real-looking face, a license plate, or anything else you shouldn't broadcast. Feed it an IMAGE (or batch) and get the mosaic back, with a few controls over how the blocks look.

The mechanism is straightforward block averaging: each cell of the image gets reduced to a single representative color. The two color_mode options decide which color that is - average takes the mean color of the whole block (the smooth, standard mosaic), original takes the center pixel's color (a chunkier, more "pixelated" look). Then opacity, brightness, and invert_color let you blend or tone the result, so you can make a light censoring pass instead of an opaque wall of blocks. It's a filter - one pass over pixels, no model involved, no VRAM cost beyond the image itself.

The inputs

  • images - the image or batch to mosaic.
  • dot_size - the block size in pixels, 1 to 512 (default 20). Bigger blocks = more aggressive censor.
  • color_mode - average (block mean) or original (center pixel).
  • opacity - 0 to 1, how much the mosaic shows over the original.
  • brightness - -100 to 100 (darken or lighten the blocks).
  • invert_color - flips the colors.

Output

IMAGE - the mosaicked image (or batch).

Installing it

ComfyUI Manager → search "D2-nodes-ComfyUI" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI

Restart. No model downloads, deps are piexif and charset-normalizer. Since v32.0.0 the pack targets ComfyUI's V3 schema - older ComfyUI builds should pin before 32.0.0.

The honest take

The author wrote a whole note.com article about wiring this into an automatic mosaic workflow - combine it with a face-detection mask and you get "auto-censor any generated faces" instead of hand-painting. For that you'd mask first, apply the mosaic, and composite; the filter itself is dumb about where - it mosaics the whole image, so pair it with a mask route or a crop to hit just the region you care about. Also worth remembering: at opacity 1 with average color it's fully covering, but lower opacity leaves the original bleeding through, which is either a soft-censor aesthetic or a privacy leak depending on how you set it. Set dot_size generously if the point is actually hiding something.

CategoryD2/Image

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
dot_sizeINT201–512
color_modeCOMBO2 options: average, original
opacityFLOAT1.000–1
brightnessINT0-100–100
invert_colorBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE