Nodes/ComfyUI XWAVE Nodes/XWAVE Pixelate
ComfyUI Node

XWAVE Pixelate

Pixelation that picks a smarter color per block

By XWAVEart·Created about a year ago·Updated about a year ago· 2
XWAVE Pixelate
  • image
  • image
pixel_width8
pixel_height8
attributehue

Pixelation sounds like the most boring node in the world - resize down, resize up, done. XWAVE Pixelate has one twist that makes it worth a second look: instead of just averaging each block, it picks the fill color based on an attribute. In color mode it grabs the most common color in the block (great for flat, poster-like mosaics). In hue, saturation, brightness, or luminance mode it averages that attribute across the block and then picks the actual pixel closest to the average. The difference is subtle and it's the whole point: attribute-based blocks preserve character the way plain averaging flattens away.

How it works

The image is carved into blocks of pixel_width × pixel_height. For each block:

  • color - count unique colors, use the most frequent one.
  • brightness / hue / saturation / luminance - average the attribute, then find the pixel whose value is closest to that average and use its full color.

That last step is what keeps blocks from turning gray. Averaging hue alone would give you mush; grabbing the nearest real pixel keeps saturation and brightness intact.

Inputs: pixel_width and pixel_height (1–256, separate so you can do non-square blocks), and attribute - which defaults to hue, not color. That's a deliberate-feeling choice: hue-based pixelation gives that smoothed, painterly mosaic look out of the box. Output is a single IMAGE (the output is literally named image), into Preview/Save.

Where it shines

  • Anonymizing / censoring faces - big blocks, color mode.
  • Retro 8-bit / mosaic poster looks - moderate blocks, hue or saturation.
  • Sketch-to-pixel studies - luminance mode keeps tonal structure readable.
  • Censoring without being boring - hue at block size ~16 looks like a deliberate art choice, not a redaction.

Installing it

It's in ComfyUI XWAVE Nodes. ComfyUI Manager → search "XWAVE" → install ComfyUI XWAVE Nodes → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/XWAVEart/comfyui-xwave-xlitch-nodes
cd comfyui-xwave-xlitch-nodes
pip install -r requirements.txt

Pillow, numpy, scipy - no models, no keys. One install covers the pack.

Gotchas

  • Small blocks are slow. It's a double Python loop over every block in the image, and color mode does a unique-color count per block. Blocks of 8 on a 4K image is thousands of blocks; give it a second or three. Single images fine, video batches not so much.
  • color mode and gradients fight. In smooth gradients every pixel is unique, so "most common color" is a coin flip. For photographic images, the attribute modes are usually better.
  • pixel_heightpixel_width is fine but weird at extremes. A 1×256 block becomes vertical stripes - which is honestly a fun accidental effect.
  • The README calls the category "Pixelation Effects" but in the node menu it lands under XWAVE/Effects. Search for it if you can't find it.

This pack is brand new and has no community footprint to lean on, so expect to tune by eye. But the attribute trick is real and it's the reason this node beats a naive "shrink and stretch" approach for anything artistic.

CategoryXWAVE/Effects

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
pixel_widthINT81–256
pixel_heightINT81–256
attributeCOMBOhue5 options: color, brightness, hue, saturation, luminance

Outputs (1)

NameTypeDescription
imageIMAGE