Sprite Fusion Pixel Snapper
- Online version: https://spritefusion.com/pixel-snapper
- Desktop version: https://www.spritefusion.com/pixel-snapper#desktop-edition
A tool to snap pixels to a perfect grid. Designed to fix messy and inconsistent pixel art generated by AI.
Why ?
Current AI image models can't understand grid-based pixel art.
- Pixel are inconsistent in size and position.
- The grid resolution can drift over time.
- Colors are not tied to a strict palette.
With Pixel Snapper:
- ✅ Pixel are snapped to a perfect grid.
- ✅ The grid resolution is consistent and can be scaled to pixel resolution.
- ✅ Colors are tied to a strict, quantized palette. You can also use a custom palette.
Perfect for
- AI generated pixel art that needs to be snapped to a grid.
- Procedural 2D art that doesn't fit a grid like tilemaps or isometric maps.
- 2D game assets and 3D textures that need to be perfectly scalable.
💻 Use it with CLI
Requires Rust installed on your machine.
Process one image:
The command accepts an optional k-colors argument:
Use a directory as the input path to process a batch.
Override the auto-detected pixel size with --pixel-size:
This is useful when the auto-detection doesn't match the expected grid size. The value must be between 1 and half the smallest image dimension.
Constrain the output to a fixed palette with --palette, passing comma-separated hex colors:
Run spritefusion-pixel-snapper --help to see every option.
Build from source
The binary will be available at target/release/spritefusion-pixel-snapper.
🌐 Use it on the Web (WASM)
Build the WASM module:
Then use the WASM module in your project:
import init from "./pkg/spritefusion_pixel_snapper.js";
await ;
// process_image(inputBytes, kColors?, pixelSizeOverride?, paletteHex?)
const outputBytes = ;
// With a custom palette
const recoloredBytes = ;
Pass null for any optional argument you want to leave on its default behavior.
Acknowledgments
Pixel Snapper is a Sprite Fusion project. Sprite Fusion is a tool to generate TRUE pixel art sprites and animations for game development.
License
MIT License Hugo Duprez