Nodes/Pixelization/Pixelization
ComfyUI Node

Pixelization

Pixel art that doesn't look like a resized mess

By filipemeneses·Created 3 years ago·Updated 6 months ago· 133
Pixelization
  • image
  • IMAGE
pixel_size4
upscale_aftertrue
copy_huefalse
copy_satfalse
copy_valfalse
restore_dark15
restore_bright1

If you've ever tried to make pixel art by just shrinking an image, you know the problem: you get a noisy, mushy thumbnail, not a sprite. Downscaling is the easy half - every image editor can do it. The hard half is turning a photo into something that reads as deliberate pixel art, with clean blocks and coherent colors instead of random speckle. That's the job this node was built for.

Pixelization is a port of the "Make Your Own Sprites" paper (WuZongWei6/Pixelization, which itself grew out of the A1111 extension of the same name). It's a single node in postprocessing/Effects: you feed it an IMAGE, it hands back an IMAGE. Nothing else. It ships as part of the filipemeneses/comfy_pixelization pack, and there's exactly one node in it.

How it actually works

Don't be fooled into thinking this is a fancy resize. The pack loads three model files from its own checkpoints folder: 160_net_G_A.pth (a c2pGen generator), alias_net.pth (an antialias network that smooths the blocky output), and pixelart_vgg19.pth (a VGG19 feature extractor used inside the pipeline). The generator runs the image through a style transfer using AdaIN, and here's the fun bit: the style code isn't tunable - it's a hardcoded 256-float MLP baked into the pack's constants.py. You get one pixel-art style, the paper's trained look, and that's it.

The flow in the source is: your image gets pre-scaled by 4 / pixel_size, center-cropped to a multiple of 4, run through the generator then the antialias net, downscaled by 4 with NEAREST resampling, and optionally recolored from the original. This is why it beats a plain resize node - the model has learned what pixel art should look like, so you get blocks with edges and defined colors instead of noise soup.

The inputs that matter

There are eight, and most you'll leave alone:

  • pixel_size (1–32, default 4) - this is really "block size." Bigger equals chunkier. At 4, each output pixel covers a 4×4 block of the source.
  • upscale_after (default true) - when on, the pixelated result is scaled back up to your original resolution with NEAREST. Off, you get a genuinely small sprite (W/pixel_size by H/pixel_size). Both are useful; the default keeps your workflow resolution consistent.
  • copy_hue / copy_sat / copy_val - copies the hue, saturation, or brightness from the original image onto the pixel art. Turn these on when you want the sprite to keep the source photo's colors rather than the model's palette. Note copy_val isn't a plain copy: it blends the original brightness back in, governed by the last two inputs.
  • restore_dark / restore_bright (0–100) - what percentage of the original image's value to restore for dark vs. bright pixels. Defaults (15 / 1) mean dark regions keep a bit of the original's shading while bright ones get flattened to the style.

The output wires straight into anything that takes an IMAGE - Save Image, a VAE decode path, another postprocessing node.

Installing it

ComfyUI Manager: search "Pixelization" and install. Manual, same as always:

cd ComfyUI/custom_nodes
git clone https://github.com/filipemeneses/comfy_pixelization
cd comfy_pixelization
python ./install.py

That install.py step matters - it pulls the Pixelization submodule and deletes a colliding models/__init__.py that breaks BLIP. Then the gotcha that will bite you on first use: the node refuses to load without its checkpoints. Grab all three from the README's Google Drive links (or the CivitAI mirror, model 1674670) and drop them in ComfyUI/custom_nodes/comfy_pixelization/checkpoints/. The console prints direct download links when it finds them missing, and the node raises a RuntimeError until they're there.

One more heads-up: the pack's pyproject.toml pins torch 2.7.1 / torchvision 0.22.1 / numpy 2.3.0. Install via Manager or git clone and those never get touched - but if anything tries to pip-install the package as a dependency, it will try to re-pin your torch. Don't let it.

Where people get burned

The three models load at node-construction time, so the first instantiation is slow - that's normal. And if copy_hue or copy_sat is on, the recoloring loops over every pixel in pure Python, which crawls on large images; keep pixel_size reasonable and expect a wait. It's a niche tool - if you only want chunky pixels, a plain nearest-neighbor resize gets you 80% there for free. Reach for this when you want the trained sprite look that resize alone can't fake.

Categorypostprocessing/Effects

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
pixel_sizeINT41–32
upscale_afterBOOLEANtrue
copy_hueBOOLEANfalse
copy_satBOOLEANfalse
copy_valBOOLEANfalse
restore_darkINT150–100
restore_brightINT10–100

Outputs (1)

NameTypeDescription
IMAGEIMAGE