用 Cargo 安装需先自行安装 Rust 工具链;--pixel-size 取值必须在 1 到最小图像边长的一半之间;WASM 版需先用 wasm-pack 构建出 pkg 目录
spritefusion-pixel-snapper
Hugo-DzMIT活跃维护把 AI 生成的像素画自动对齐到规整网格,修掉边缘错位和大小不一的像素块,让杂乱的像素图变得干净可用。
A tool to snap pixels to a perfect grid. Designed to fix messy and inconsistent pixel art generated by AI.
brew install Hugo-Dz/tap/spritefusion-pixel-snapper
cargo install spritefusion-pixel-snapperREADME 未说明,仅提到 CLI 是原生二进制、网页版通过 WASM 运行,未提及显存或 GPU 要求
把 AI 生成的像素画对齐到完美网格并量化配色的工具
把 AI 生成的像素画自动对齐到规整网格,修掉边缘错位和大小不一的像素块,让杂乱的像素图变得干净可用。
核心能力
- 自动检测像素尺寸并把像素吸附到规则网格
- 把颜色量化到严格调色板,也支持自定义十六进制色板
- 支持 PNG/JPEG 单图或整目录批量处理
- 提供 CLI、WASM 网页模块和桌面版三种用法
容易踩的坑
暂无 release 数据(可能没有发版,或尚未同步)。
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
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.
💻 CLI
Brew
brew install Hugo-Dz/tap/spritefusion-pixel-snapper
Cargo
Installation with Cargo requires Rust. Once installed, the CLI runs as a standalone native binary.
cargo install spritefusion-pixel-snapper
Usage
spritefusion-pixel-snapper <INPUT> <OUTPUT> [COLOR_COUNT] [OPTIONS]
<INPUT>: A PNG/JPEG image, or a directory for batch processing.<OUTPUT>: An output PNG, or a different output directory for a batch.[COLOR_COUNT]: Number of palette colors. Defaults to16.--pixel-size <PIXELS>: Overrides the auto-detected pixel size. The value must be between 1 and half the smallest image dimension.--palette <HEX,...>: Constrains the output to comma-separated six-digit hex colors.
Examples:
# Quantize the image to a 16-color palette
spritefusion-pixel-snapper input.png output.png 16
# Process a directory as a batch
spritefusion-pixel-snapper sprites/batch_inputs sprites/batch_outputs 16
# Override the auto-detected pixel size
spritefusion-pixel-snapper input.png output.png --pixel-size 8
spritefusion-pixel-snapper sprites/batch_inputs sprites/batch_outputs 16 --pixel-size 8
# Use a fixed color palette
spritefusion-pixel-snapper input.png output.png --palette "0d2b45,203c56,544e68,8d697a,d08159,ffaa5e,ffd4a3,ffecd6"
spritefusion-pixel-snapper sprites/batch_inputs sprites/batch_outputs --palette "0d2b45,203c56,544e68,8d697a"
Run spritefusion-pixel-snapper --help to see every option.
Build from source
git clone https://github.com/Hugo-Dz/spritefusion-pixel-snapper.git
cd spritefusion-pixel-snapper
cargo build --release
The binary will be available at target/release/spritefusion-pixel-snapper.
🌐 Web (WASM)
git clone https://github.com/Hugo-Dz/spritefusion-pixel-snapper.git
cd spritefusion-pixel-snapper
Build the WASM module:
wasm-pack build --target web --out-dir pkg --release
Then use the WASM module in your project:
import init, { process_image } from "./pkg/spritefusion_pixel_snapper.js";
await init();
// process_image(inputBytes, kColors?, pixelSizeOverride?, paletteHex?)
const outputBytes = process_image(inputBytes, 16);
// With a custom palette
const recoloredBytes = process_image(inputBytes, null, null, "0f0f1b,ffecd6,ff4d6d,29adff");
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.
Other open source pixel art tools
Sprite Fusion Sprite Normals: generate normal maps for pixel art sprites and animations, so they react to dynamic lighting.
- Online version: https://www.spritefusion.com/sprite-normals
- Repo: https://github.com/Hugo-Dz/spritefusion-sprite-normals
- API: https://www.spritefusion.com/docs/pixel-art-generator/api/generate-and-transform-images#normal-maps
- MCP: https://www.spritefusion.com/docs/pixel-art-generator/api/mcp
License
MIT License Hugo Duprez