KennethJAllen/proper-pixel-art
Fixes AI pixel art images, video, or sprite web uploads
What it solves
It converts noisy, high-resolution images that look like pixel art (often produced by AI generative models or low-quality web uploads) into clean, true-resolution pixel art assets. It solves the problem where standard downsampling fails because these images often have non-uniform grids and random artifacts.
How it works
The tool uses a multi-step computer vision pipeline to recover the original pixel grid:
- Preprocessing: Trims edges and handles transparency.
- Edge Detection: Uses Canny edge detection and morphological closing to find the boundaries of the "pixels."
- Grid Recovery: Employs a probabilistic Hough transform to find vertical and horizontal lines, clusters them, and snaps them to gradient projection profile peaks to establish a pixel mesh.
- Grid Validation: Estimates pixel width based on line gaps and validates it using reconstruction error (color variance within cells).
- Color Processing: Either quantizes the image to a fixed palette or preserves original colors using a dominant color method.
- Finalization: Assigns a single representative color to each cell in the mesh to create a true-resolution image.
For videos and GIFs, the tool samples a few frames to determine a single shared grid and palette, ensuring the animation remains consistent without flickering.
Who it’s for
- Game developers and artists who need to clean up AI-generated pixel art.
- Users wanting to convert low-quality web screenshots of pixel art into usable assets.
- Creators working with pixel-art style animations (GIFs/MP4s).
Highlights
- Animation Support: Processes videos and GIFs with frame-to-frame consistency.
- Automated Grid Detection: Automatically detects the pixel width and mesh of the source image.
- Flexible Color Control: Offers both dominant color preservation and fixed-palette quantization.
- Multiple Interfaces: Available as a CLI, Python API, and a web interface via Hugging Face Spaces.
Related
- Project
- Project
- Project
- Project
- Project