🍒Pixelate_Filter🎮像素化滤镜
Make it look like 1990s sprite art in one node
- image
- IMAGE
Pixelate_Filter turns any image into a chunky pixel-art version, and it's the one node in this pack that carries a real third-party dependency to make it work. The README's demo shows it flattening renders down to crisp, blocky, retro game style - the sort of thing people want when they're generating assets for game mockups, avatar packs, or just being nostalgic. If your workflow needs a pixel aesthetic, this saves you from building the downscale-quantize-upscale chain by hand.
How it works
There are two modes, and they're genuinely different pipelines.
lanczos4 mode (the default) is pure OpenCV: it shrinks the image to size pixels on its long edge with high-quality LANCZOS4 resampling, optionally quantizes the colors down to colors levels, then scales back up to the original dimensions with nearest-neighbor interpolation. That nearest-neighbor blow-up is what gives you the hard, square pixels. Simple, fast, no extra libraries.
contrast mode is where it gets interesting: it hands the image to pixeloe, a dedicated pixel-artization library, with your block_size and edge_thickness as pixel dimensions and stroke thickness. It even tries two different pixeloe APIs (the torch one, then the legacy one) before falling back to its own manual quantizer, so it's reasonably robust to which pixeloe version you've got. This mode is the one that produces the "modern stylized" pixel look with defined block outlines rather than just chunky downscaling.
The inputs that matter
- mode -
lanczos4orcontrast. Start with lanczos4 for a clean classic look; switch to contrast when you want styled pixel blocks with edges. - size, default 128 (32–256, step 4). Target resolution for the long edge before upscaling. Lower = chunkier.
- block_size, default 16 (4–32) - pixel block size, contrast mode only.
- edge_thickness, default 4 (1–16) - thickness of the block outlines, contrast mode only.
- colors, default 128 (2–256). Color count after quantization; lower gives a more limited, retro palette. Setting it near 2 gets you nearly posterized flat colors.
One output: IMAGE, same dimensions as the input (it always upscales back to the original size), so it drops straight into a Save Image or compositor without resizing headaches.
Installation
Installing the pack gets you most of this node, but contrast mode needs pixeloe - and this is the pack's one declared pip dependency:
cd ComfyUI/custom_nodes
git clone https://github.com/wjl0313/ComfyUI_KimNodes
cd ComfyUI_KimNodes
pip install -r requirements.txt # installs pixeloe
ComfyUI Manager (search "KimNodes") handles this for you. lanczos4 mode works even without pixeloe, which is nice - the pack degrades gracefully.
Common issues
The most common failure is a hard ImportError on the contrast mode telling you pixeloe isn't installed - that's the message you see when you've installed the pack through Manager but its dependency resolution lagged behind. pip install pixeloe fixes it. Worth knowing: block_size and edge_thickness do nothing in lanczos4 mode, so if you're sliders-and-puzzled about why nothing changes, you're on the wrong mode. And if you feed it a very large image, the color quantization on millions of pixels gets slow - drop colors to something like 64 for faster results. This is a small, focused node that does exactly one thing, and it does it well.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mode | COMBO | lanczos4 | 2 options: lanczos4, contrast |
| size | INT | 12832–256 | — |
| block_size | INT | 164–32 | — |
| edge_thickness | INT | 41–16 | — |
| colors | INT | 1282–256 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |