Nodes/AI Pixel Art Enhancer for ComfyUI/🎨 AI Pixel Art Enhancer
ComfyUI Node

🎨 AI Pixel Art Enhancer

The AI Pixel Art Enhancer node

By HSDHCdevΒ·Created about a year agoΒ·Updated 4 months agoΒ· 39
🎨 AI Pixel Art Enhancer
  • image
  • input_palette
  • enhanced_image
  • comparison_grid
  • palette
β—„pixel_size8β–Ί
β—„conversion_methodβ–Ύβ–Ί
β—„color_similarity_threshold30β–Ί
β—„enable_ai_enhancementtrueβ–Ί
β—„noise_reduction0.3β–Ί
β—„edge_enhancement0.5β–Ί
β—„color_quantization16β–Ί
β—„dithering_strength0.0β–Ί
β—„palette_extractionmedian_cutβ–Ί
β—„color_matching_spacergbβ–Ί
β—„contrast_boost1.0β–Ί
β—„saturation_boost1.0β–Ί
β—„preserve_detailstrueβ–Ί
β—„anti_aliasingfalseβ–Ί
β—„batch_processingtrueβ–Ί

The name oversells it. There's no API call, no key, no model download hidden inside - the "AI" is a preprocessing pipeline of bilateral filters, Canny edges, and color quantization. What you actually get is the fastest route from "a diffusion model drew me something vaguely pixel-arty" to "crisp, blocky, actually-good pixel art." Diffusion models are famously bad at producing clean pixels - they smear the grid into mush. This node snaps that mush to a real grid with hard edges, and does it deterministically, which is exactly why you want it in the workflow rather than another img2img pass.

What it does

Feed it any image and it downsamples to a coarse grid, picks a representative color for every cell, then scales back up to the input resolution with nearest-neighbor. That last bit is the trick: your output resolution always matches your input, so nothing downstream (VAE, video, compositing) breaks. The author's own demo workflow pairs it with the Pixel Art Style Illustrious LoRA by Skormino - generate in the right style first, then let this node do the crispening. That combo is the intended path, and it works.

How it works

The grain size sets the grid: grid = (width // pixel_size, height // pixel_size). For each cell, one of six conversion_methods decides the representative color - most_frequent (mode), average (mean), neighbor_aware, brightness-weighted light/dark, or edge_preserving. With enable_ai_enhancement on (default), the node first runs OpenCV's bilateral filter for noise, Canny edge detection to preserve structure, and contrast/saturation tweaks. After conversion it quantizes colors - default palette_extraction is median_cut, with fast_octree, k_means, and a few k-means variants available - applies Floyd-Steinberg dithering_strength, and optionally maps every pixel to a fixed palette in rgb, lab, or oklab space. Oklab is the one you'll actually care about: it's perceptually smooth and avoids the hue shifts you get mapping in raw RGB.

The inputs that matter

  • pixel_size (1–128, default 8) - the grain. 4–8 for a modern indie look, 8–16 for retro, 32+ for abstract blocks.
  • conversion_method - try edge_preserving first on busy images; it keeps structure where average washes it out.
  • color_quantization (default 16) - lower for more retro. This is the dial that changes the vibe the most.
  • dithering_strength - off by default; 0.2–0.4 fixes banding on gradients.
  • input_palette - feed it any image and the node strictly maps every pixel to that image's exact colors, overriding color_quantization. Great for locking to a game's palette.
  • batch_processing (default on) - leave it on for image batches or video frames; each frame gets the same treatment.

Three outputs: enhanced_image (the result), comparison_grid (original vs. pixel art vs. final, handy for debugging), and palette - a swatch grid of every color used, sorted by hue, which you can steal for other work.

Installing it

Easiest: ComfyUI Manager β†’ search "AI Pixel Art Enhancer" β†’ install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/HSDHCdev/ComfyUI-AI-Pixel-Art-Enhancer

Then restart ComfyUI. Two gotchas here. First, the README's manual-install section literally contains a placeholder URL (yourusername/ai-pixel-art-enhancer) - don't copy it, use the real repo above. Second, the one dependency ComfyUI doesn't already bundle is opencv-python - the node does a top-level import cv2, so if it's missing the node won't even load. Install it into the same Python ComfyUI uses:

# Windows portable: ComfyUI_windows_portable\python_embeded\python.exe -m pip install opencv-python
pip install opencv-python

scikit-learn and scipy are optional - the code falls back to uniform binning / numpy broadcasting when they're absent, but you lose the better k-means quantization. Worth adding both.

Where people get burned

  • Overflow RuntimeWarnings - the most_frequent clustering does some suspicious integer math, and users on the author's release thread saw overflow encountered in scalar add warnings spew to console. Annoying but non-fatal; output still renders. The author asked for workflow exports to fix it, so it's known.
  • Washed-out colors - raise contrast_boost and saturation_boost. Classic post-quantization flattening.
  • Memory on big images - the palette matching works in chunks but still peaks on large tensors. Stick to 512–1024px input, or disable enable_ai_enhancement.
  • Blurry "pixel" edges - keep anti_aliasing off. It's a real toggle if you want it, but it defeats the point.

One caveat on support: this is a hobbyist pack (one author, one released node out of ~20 he says he's built), so expect occasional rough edges. But for "AI image in β†’ crisp pixel art out" with zero model downloads, it's hard to beat.

Categoryimage/enhancement

Inputs (17)

NameTypeDefaultDescription
imageIMAGEInput image to convert into pixel art.
pixel_sizeINT81–128Size of each 'grain' in pixels. Output resolution will match input exactly.
conversion_methodCOMBOAlgorithm used for conversion. 'most_frequent' (mode), 'average' (mean), 'neighbor_aware' (contextual), 'brightness_weighted_light' (favors brights), 'brightness_weighted_dark' (favors darks), 'edge_preserving' (keeps structural detail).
color_similarity_thresholdFLOAT305–100Threshold for color clustering. Higher values group more colors together.
enable_ai_enhancementoptBOOLEANtrueEnable AI preprocessing and post-processing for better results.
noise_reductionoptFLOAT0.30–1Strength of noise reduction filter.
edge_enhancementoptFLOAT0.50–2Intensity of edge enhancement to preserve structural details.
color_quantizationoptINT162–256Number of colors in the final output. Lower values give a more retro look.
dithering_strengthoptFLOAT0.00–1Floyd-Steinberg dithering intensity to smoothly blend colors.
palette_extractionoptCOMBOmedian_cutMethod to extract colors. 'median_cut' (fast and balanced), 'fast_octree' (fast for transparency), 'k_means' (accurate 3D spatial), 'k_means_outlier_preserved' (boosts rare high-contrast pixels), 'k_means_vibrant_preserved' (boosts highly saturated/pure colors), 'uniform_binning' (basic grid).
color_matching_spaceoptCOMBOrgbColor space to use when mapping pixels to the allowed palette. 'rgb' (standard linear math), 'lab' (CIELAB human perception), 'oklab' (newer smooth perception, prevents hue shifts).
contrast_boostoptFLOAT1.00.5–2Contrast adjustment multiplier.
saturation_boostoptFLOAT1.00–2Color saturation multiplier.
preserve_detailsoptBOOLEANtrueEnable detail preservation during processing.
anti_aliasingoptBOOLEANfalseApply subtle anti-aliasing to final output to blend jagged edges.
batch_processingoptBOOLEANtrueProcess entire batches of images (e.g., video frames). Disable for single images.
input_paletteoptIMAGEProvide an image to strictly map the result to its exact colors. Overrides 'color_quantization' maximum colors.

Outputs (3)

NameTypeDescription
enhanced_imageIMAGEβ€”
comparison_gridIMAGEβ€”
paletteIMAGEβ€”