Image Mosaic
Pixelate a face (or anything) without a trip to Photoshop
- image
- IMAGE
Mosaic is the polite word for pixelation, and this node is the "blur the license plate / hide a face before posting" tool that doesn't require leaving ComfyUI. It takes an image and replaces blocks of it with the average color of that block, which is the classic censorship look. It's also used as a deliberate stylized effect - the chunky pixel-grid aesthetic shows up in a lot of compositing and even as a conditioning trick where you pixelate, then let an upscaler guess the detail back in.
How it works
The node slices the image into a grid, computes the mean color of each block, and fills the block with that flat color. mosaic_size controls the number of divisions per axis, not the block size - the block is height // mosaic_size, so a bigger number means smaller blocks and a subtler effect. Default is 10, which on a 1024² image gives you ~102-pixel blocks: very chunky, very anonymous. Crank it down toward 2–4 for genuine anonymization (huge blocks, nothing recognizable), or up toward 50+ for a fine-grained digital look. The math runs on the numpy array in 0–1 float space, so it plays nicely with everything else in ComfyUI, and it returns a full-size IMAGE tensor (same dimensions, just flattened regions). It processes the whole batch, so a sequence of frames gets uniformly mosaic'd.
One important detail: this mosaics the entire image, not a region. If you only want a face covered, you need to crop to the face first (or mask it), apply the mosaic, then composite back. That's a small graph: Crop Image → ImageMosaic → Composite. Annoying, but it's how every full-frame pixelator works, and ComfyUI gives you the pieces to build the regional version.
The input that matters
- image - any IMAGE tensor.
- mosaic_size - integer 2–100, default 10. Lower = bigger blocks = more censored; higher = finer pixelation. Start at 10 and go down for real anonymization.
Output is a single IMAGE. From here you can preview, save, or - the fun one - feed it into a tiled ESRGAN upscaler. The upscaler will happily invent plausible detail out of the blocks, which is how people fake "de-pixelation" in one lazy step. It won't restore the original; it'll just give you a sharp hallucination of it. Keep that in mind before you rely on it for anything important.
Installing it
It's in ComfyUI-YCNodes. Install via ComfyUI Manager (search ComfyUI-YCNodes) or:
cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes
Restart ComfyUI. The pack's dependencies (torch, numpy, pillow, opencv-python, scipy) are all already present in a normal ComfyUI install; this node only touches numpy.
Gotchas
The name occasionally trips people up: in Chinese UI contexts "马赛克" (mosaic) literally means the pixelation effect, so if you see people describing a mosaic tile pattern they mean this blur-and-average look, not an actual tessellated grid of pictures. And while mosaic_size reads like a "block size" slider, it's actually the number of divisions per axis - higher values make smaller, subtler blocks. If you expected "size of each block," you'd turn it the wrong direction the first time.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mosaic_size | INT | 102–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |