AI News HubLIVE
In-site rewrite1 min read

How to fix AI-generated pixel art

Pixel Snapper converts blurry, off-grid AI pixel art into clean, grid-aligned pixel art by quantizing colors, detecting edge profiles, walking cuts, and resampling.

SourceHacker News AIAuthor: HugoDz

Join

Open Source

How to Fix AI-Generated Pixel Art

Convert AI pixel art into clean, grid-aligned pixel art while preserving the original shapes and details.

Source code 2.3k

Try online

From AI mixels to a clean pixel art

AI image models often produce blurry, inconsistent, off-grid pixels. Pixel Snapper finds the underlying grid and rebuilds the image on a consistent pixel grid.

  1. Quantize colors

Original image

Read the color of every source pixel

↓ →

K-means palette

Find representative colors

↓ →

Quantized colors

Build a limited, consistent palette

  1. Edge profiles

X/Y brightness profile

Measure the strength of each brightness change

↓ →

Estimated step size

Find the median gap between peaks

  1. Walk cuts

Median step guide

Set the expected distance between cuts

↓ →

Walked cuts

Follow the strongest nearby edge peaks

  1. Resampling

Final cut cells

Use each cell as a color voting area

↓ →

Output pixels

Keep the winning color from each cell

Result

Input

Blurry, inconsistent, off-grid pixels

↓ →

Output

Clean, grid-aligned pixel art

Source code 2.3k

Try online

Making a game? Try our Pixel Art Generator

Create pixel art now

Fast Integration with Game Engines