Pixel Snap Cleanup (AI fake pixels to true pixel art)
/pixel-snap-cleanup
A GameSkill original that turns AI "fake pixel" art into true pixel art at the grid you choose: snap to a real grid with the bundled Pixel Snapper (MIT), force 0/255 alpha and a fixed palette, hit the exact size, then check it is CLEAN and imports crisp into Godot 4. Works on single sprites and on animation frames, which share one grid.
- 许可证
- MIT
- 出品
- GameSkill 出品
我们测过
在 Pixel Snapper 1.0.0 (Rust, built with cargo) + Godot 4.7.2 (texture import) 上通过 43/43 项检查(2026-11-09):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。
测试报告GameSkill 测过的版本
GameSkill 为 gameskill.dev 原创编写并测过。ZIP 里是完整的 skill:SKILL.md 及中文版、脚本、可运行示例、测试、自检清单和我们的测试报告。
GameSkill 原创,协议 MIT。ZIP 保留 LICENSE 和 CREDITS.md,里面列出了流程灵感来源、CC0 测试素材和第三方库及其协议。
自检清单
- 先问清网格大小、调色板、单张还是动画帧 / Ask for the grid size, the palette and whether it is one image or frames
- snap.py 每张图都以 PASS ... CLEAN 结束 / snap.py ends with PASS ... CLEAN for every image
- 透明度只有 0/255,颜色都在调色板里 / Alpha only 0/255 and every colour in the palette
- 动画帧在同一次调用里对齐 / Animation frames were snapped in one call
- Godot 项目用 Nearest 过滤、Lossless 导入 / The Godot project uses the Nearest filter and Lossless import
推荐搭配
中文指南
这个 skill 做什么
GameSkill 原创(MIT)。把 AI 画的"假像素画"(边缘发糊、格子大小不一、几百种相近的颜色、半透明描边)还原成你要的网格下的真像素画:用内置的 Pixel Snapper(MIT)对齐到真实网格,透明度只留 0/255,颜色锁到固定调色板,裁到准确尺寸,最后检查是否 CLEAN,以及在 Godot 4 里导入是否清晰。单张 sprite 和动画帧都能处理,动画帧共用一个网格。
什么时候用
- 图像模型生成的 sprite、图块、道具本该是像素画,但边缘糊、颜色多
- 动画帧各自对齐导致在游戏里抖动
- 想在放进 Godot 或网页游戏前,把 AI 美术锁到游戏的调色板和固定尺寸
怎么装
下载本页的 ZIP,把 pixel-snap-cleanup/ 文件夹放进 .claude/skills/(Claude Code)或 .agents/skills/(Codex、Cursor),重启 agent。需要 Python 3,以及用来编译一次 Pixel Snapper 的 Rust(cargo,会按 Cargo.lock 从 crates.io 拉依赖);Godot 4 只在做导入检查时需要。
最小示例
SNAPPER=$(sh tools/build_snapper.sh | tail -1)编译内置的 Pixel Snapper。python3 tools/snap.py "$SNAPPER" example/moss-cap-ai-look.png out/moss-cap.png --grid 32x32 --palette 1d2b53,7e2553,ff004d,ff77a8,fff1e8,008751,00e436,ab5236,ffccaa,000000,打印PASS ... 32x32 CLEAN。python3 tools/pixtool.py compare out/moss-cap.png example/moss-cap.png --shift 1,和原图对比一致。
我们怎么测的
示例是我们自己画的 32x32「苔藓蘑菇」(绿色菌盖、粉色地衣斑点、没有脸),用 PICO-8 的 10 种颜色。pixtool fake 把它做成 AI 风格的副本:格子大小随机偏差 ±6%、模糊、噪点、半透明边缘。test/run_tests.py 共 30 项检查,用 Rust 1.85 编译的 Pixel Snapper 和 Godot 4.7.2 跑:
- 5 组缩放/种子(每格 5.6、7.3、9.1 像素):输入和简单缩小都判为 NOT CLEAN;snap.py 全部得到 32x32 CLEAN,和原图一致率 99.6%-100%,其中 2 组自动检测出了 32x30,靠固定像素尺寸重试修好;
- 4 帧上下浮动的动画用同一个像素尺寸对齐,全部 CLEAN,拼成 128x32 的 sprite sheet 和 4 帧 JSON;
- fit 拒绝切掉有画面的行列,check 能抓出一个半透明像素和一个调色板外的像素;
- Godot 4 以 Lossless、无 mipmap、Nearest 过滤、32x32 导入清理结果,尺寸不对的图会被判失败。
截图左边是 AI 风格输入,右边是清理后的 32x32 放大 8 倍。结果在 gameskill/test-report.json。
致谢
对齐算法来自 Hugo Duprez 的 Sprite Fusion Pixel Snapper(MIT,源码原样内置并保留 LICENSE)。"先对齐网格再锁调色板"的流程参考了 mono-pix 的思路(它没有许可证,只放链接,没有使用任何代码或文字)。需要真实像素画参考时可用 CC0 数据集 Pixel Art Atlas 1.4M。
搭配
style-cards:先定像素风格和调色板pixel-diorama-game:用纯代码做像素小场景glb-godot-acceptance:3D 资产的 Godot 验收
安装
告诉你的 AI
Install the skill from https://gameskill.dev/skills/pixel-snap-cleanup/install.md
GameSkill 测过的版本
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/pixel-snap-cleanup.zip -o /tmp/gameskill-pixel-snap-cleanup.zip
unzip -oq /tmp/gameskill-pixel-snap-cleanup.zip -d .claude/skills
rm /tmp/gameskill-pixel-snap-cleanup.zip包含内容
- tools/snap.py: snap, finish, fit and check in one command, with a fixed pixel size for animation frames; PASS / FAIL per image
- tools/pixtool.py: check (binary alpha, colour count, uniform cells, palette), finish, fit, compare, sheet (Aseprite-style JSON), upscale and a fake-pixel generator for tests
- vendor/pixel-snapper: Sprite Fusion Pixel Snapper 1.0.0 source with its MIT licence, unchanged, and tools/build_snapper.sh
- tools/godot_import_check.py: proves the sprite imports into Godot 4 lossless, nearest filter, at the right size
- Our own moss-cap toadstool sprite, an AI-looking copy to practise on, and 30 checks in test/run_tests.py
适合
- Sprites, tiles and items from an image model that should be pixel art but have soft edges and hundreds of colours
- Animation frames that jitter because each was snapped on its own grid
- Locking AI art to a game's fixed palette and a fixed size before it goes into Godot or a web game
不适合
- Drawing the art or choosing a style: use style-cards or the art skills
- Images that are not a grid at all (perspective scenes, rotated or mixed-scale art): crop or redraw first
- Upscaling pixel art for print or video
试试这条提示词
My image model made a 32x32 mushroom sprite, but it is 230 pixels wide, blurry and has 400 colours. Make it real 32x32 pixel art in the PICO-8 palette and check it imports crisp in Godot.关于这个 Skill
A GameSkill original. Image models draw sprites that look like pixel art at a glance but are not: each "pixel" is several real pixels of uneven size, edges are blurred, there are hundreds of colours and the outline is half-transparent. tools/snap.py turns such an image into true pixel art at the grid you ask for: it snaps it to a real grid with the bundled Pixel Snapper (MIT), retries with a fixed pixel size when auto-detection picks the wrong grid, forces 0/255 alpha and your palette, trims or pads only empty rows and columns to the exact size, and checks the result is CLEAN. Animation frames share one pixel size so they do not jitter, and godot_import_check.py proves the sprite imports into Godot 4 crisp.
Agent steps
- Ask for the grid (for example 32x32), the palette or the colour limit, and whether it is one image or frames.
- Build the snapper once with
tools/build_snapper.sh. - Run
snap.py(frames in one--out-dircall) and fix each FAIL from the table in SKILL.md. - Check the result next to the input, make a sheet if needed, and run the Godot import check for a Godot game.
Common problems it fixes
- Soft, half-transparent edges and hundreds of near-identical colours that a plain downscale keeps.
- A grid detected one row off (32x30 instead of 32x32), fixed by the fixed-size retry and an empty-line fit.
- Frames that each land on a different grid, and sprites that look blurry in Godot because of the texture filter.
Credits
The grid snapping is Sprite Fusion Pixel Snapper by Hugo Duprez (MIT), shipped unchanged with its licence. The snap-then-palette flow was inspired by mono-pix (no licence; link only, no code or text used). The tools, the moss-cap example and the text are ours.
环境要求
- Python 3 standard library; no packages
- Rust stable with cargo (tested on 1.85) to build the bundled Pixel Snapper once; its crates come from crates.io, pinned by Cargo.lock
- Godot 4.2+ only for the optional import check (tested on 4.7.2)
相关主题
常见问题
AI 2D 美术与序列帧管线 Sprite Asset Pipeline
把 AI 生成的原始视频直接变成商业级透明 2D 游戏序列帧:绿幕/溢色消除命令、0px 脚底锚点锁死排版、动作非线性重定时(4.33s → ~1.88s 含打击顿帧)与 Phaser / Godot 4 图集一键导出。
基于 Sprite Fusion Pixel Snapper (作者 Hugo Duprez,MIT; source shipped unchanged at 02f9315)。原作者的代码原样打包进 ZIP,附带其许可证;skill 文字、测试和示例由 GameSkill 编写,ZIP 里的 CREDITS.md 列出所有来源。 · 基于 mono-pix (idea only) (作者 handsupmin,no licence file, idea only, no code or text used)的思路。代码和文字由 GameSkill 编写,ZIP 里的 CREDITS.md 列出所有来源。
搭配使用
作者标注的相关 Skills,或更适合相邻任务的 Skills。
Style Cards (one art style as hard limits, switch looks by switching cards)
A GameSkill original that writes a game's art style down as a card of measurable limits (canvas, colours and palette, alpha, triangles, shading, materials, textures, voxel grid), pastes it into every asset request and checks every asset against it. Ships 16 cards from pixel (including fixed PICO-8, CGA, four-greens LCD and Endesga 32 palettes) and one-bit to low-poly, voxel and toon, a no-dependency PNG checker, a Blender GLB checker and a palette locker; switch the whole look by switching the card.
Pixel Diorama Game (tiny isometric pixel games with seamless ambience)
A GameSkill original for making a small browser game as an isometric pixel diorama: one place floating on white, a fixed 30-degree camera, a 360x280 canvas scaled by whole pixels, hue-shifted shading, long hard shadows and one physical action, plus rain, ripples, smoke, embers and lamp flicker drawn by code in loops that wrap without a seam. Ships the Pixel Plays renderer (MIT), our ambience kit and a tested example game.
GLB to Godot Acceptance (is this model really done?)
A GameSkill original that decides whether a 3D model is ready for a game: Godot 4 imports the GLB like any file in the project, then checks import errors, triangle budget, size in metres with Y up, origin at the base, materials, colliders, the clips the code plays, a drop test on a floor and runtime errors, with a fix for every failure. Works on any GLB from Blender or an image-to-3D model.
相似 skills
Agent Sprite Forge
Five agent skills that turn one approved character still into a game-ready sprite set: one image-to-video clip per action, then deterministic Python tools key, register, loop, retime, palette-lock and export it for Godot, Aseprite and the web. Also maps, tiles and code-drawn art.
pixelfx
244 pixel-art effects written as code (fire, explosions, magic, weather, UI, pickups, critters) plus a draft, render, look, refine loop for making new ones; every effect exports a sprite sheet with Aseprite-style JSON for Godot, Unity, Phaser or any engine.
Shader Art Coding (GLSL / Shadertoy)
A tested library of 186 GLSL building blocks plus a workflow for procedural fragment shaders: SDF raymarching, 2D distance fields, noise and fBm, terrain, water, clouds, lighting and tonemapping. A Python bundler inlines only the functions a shader uses, and a checker lints it for the mistakes that break WebGL. Good for game backdrops, title screens, portals, pickups and full-screen effects.
Codixel
A pixel-art skill built on one idea: the agent writes code, it is not a painter. It asks for a reference image, then removes the background, pixelates, rigs with bones and animates it in code with a 2,000-line toolkit (core/pixel.js), showing every step on a sheet before making game files.