/vibedgames:pixel-snapperfrom vibedgames
Recovers native low-resolution pixel grids from upscaled or AI-generated pixel art PNGs. Palette-quantizes and slices known-layout spritesheets.
Ships in vibedgames. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Recover the underlying low-resolution pixel grid from images that look like pixel art but are stored at high resolution with anti-aliased/smudged edges (e.g. a 1024×1024 AI-generated character that conceptually has ~100×100 chunky pixels).
scripts/pixel-snapper.mjs is a Node port of an MIT-licensed Rust implementation (see references/credits.md), dimensionally identical to upstream. scripts/pixel-snapper-sheet.mjs is a known-layout spritesheet helper: crops frames, snaps them together as one strip so every frame shares a single pixel grid, reassembles.
Naive downscale (Lanczos/bilinear/nearest) averages neighbors → blur or aliasing. Snapping instead discovers where the conceptual pixel boundaries already exist and snaps to them. Output resolution is a property of the input, not a parameter.
Before running, ask:
--k-colors 256; pre-quantized retro palettes may want a smaller k (16, 32, 64).Core principles: output resolution is discovered, not specified · k_colors is the only user-facing knob (other tunables live in DEFAULT_SNAP_CONFIG) · always inspect the output by eye — dimensions are a sanity check, not a quality check · keep the source PNG so you can re-snap with a different k_colors later · key the background out before snapping — a wide flat matte gives the walker nothing but its own edges to lock onto, and the recovered "grid" collapses to a handful of pixels · snapping needs resolution to find the grid — feed it a large source (≥~512px across the subject; a lone character ~1024²). Undersized inputs (256²) blur the grid away or trip the 64×64 fallback; the fix is to regenerate larger, not to upscale a small source first.
Use when the user has AI-generated "pixel art" (gpt-image, retro-diffusion, etc.) and wants a cleaner/smaller/palette-quantized version, needs a high-res mockup converted to a true pixel-art asset, wants to recover an upscaled retro asset's grid, or mentions "snap to pixel grid", "fake pixel art", "downsample to native res", or the Hugo-Dz repo.
Skip for: photographs / continuous-tone / vector art (no grid to recover); already-native pixel art (would just round-trip, possibly losing detail); spritesheet layout recovery where rows/cols are unknown (probe first — pixel-snapper-sheet.mjs expects known --cols/--rows).
Nothing to install — the scripts import a bundled scripts/_lib/asset-tools.mjs and need only Node:
# This skill's directory. Claude Code substitutes CLAUDE_SKILL_DIR (project, global
# or plugin install); other agents fall back to wherever `vg init` put it.
SKILL="${CLAUDE_SKILL_DIR}"
[ -d "$SKILL" ] || for d in .agents/skills .claude/skills ~/.agents/skills ~/.claude/skills; do
[ -d "$d/pixel-snapper" ] && SKILL=$d/pixel-snapper && break
done
node $SKILL/scripts/pixel-snapper.mjs input.png output.png --k-colors 256
After chmod +x, the shebang #!/usr/bin/env node lets you call it directly:
$SKILL/scripts/pixel-snapper.mjs input.png output.png --k-colors 256
Output is one snapped PNG at the discovered native resolution. For inspection, follow up with an integer nearest-neighbour upscale — nearest at an integer factor keeps every pixel a hard square, so you judge the recovered art rather than a resampler's smoothing:
node $SKILL/scripts/image-util.mjs upscale snapped.png snapped-x8.png --factor 8
For a known-layout spritesheet, snap every frame to one shared pixel grid:
node $SKILL/scripts/pixel-snapper-sheet.mjs \
sheet.png sheet-snapped.png --cols 6 --rows 1 --k-colors 256
See references/usage-examples.md for batch processing and verification recipes.
k_colors — start 256 for AI renders; for quantized retro art try 16, 32, 64 ascending until detail survives without noise.iw*8 nearest-neighbour upscale.k_colors (halve/double); non-square cells (snapper picks the smaller pitch → may need pre-resize); exactly 64×64 output = step-detection fallback fired (input may lack detectable pixel structure). The script prints a warning for both collapse modes and --strict turns them into exit 1, so a batch can stop instead of writing a 2×2 file that looks like a success.experiments/, never directly into public/assets/. Promote only after visual approval.DO NOT treat snapping as a mandatory cleanup step for every asset — use it only when the input has a recoverable pixel grid.
k_colors=16 on vibrant AI renders — crushes detail. Default to 256 for AI sources; drop only if output looks noisy.--width/--height by design. Snap first (recover native), then nearest-neighbour upscale to a multiple; don't snap-and-resize in one step.public/assets/ — save to experiments/<timestamp>-pixel-snapper-<subject>/, promote after review.Don't run the same parameters on every input.
k_colors to palette complexity — a 16-color NES-style file doesn't need 256; an AI render with smooth shading may lose definition at 16.k_colors (logos low, character medium, tile high).k_colors and re-run from source.references/algorithm.md — pipeline walkthrough (quantize → profile → step-size → walk → resample)references/credits.md — MIT license + attributionreferences/usage-examples.md — invocation patterns + inspection recipesThe snapper does one thing well: recover a hidden pixel grid. It's not a general downscaler, asset cleaner, or palette converter for arbitrary art. When the input fits — upscaled/AI-faked pixel art — it produces what a human pixel artist would have drawn. When it doesn't, no parameter tuning will save you; use a different tool.
references/algorithm.md (opens in a new tab)references/credits.md (opens in a new tab)references/usage-examples.md (opens in a new tab)scripts/_lib/asset-tools.mjs (opens in a new tab)scripts/image-util.mjs (opens in a new tab)scripts/pixel-snapper-sheet.mjs (opens in a new tab)scripts/pixel-snapper.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kyh/vibedgames --plugin vibedgames35 skills in this plugin
/animated-spritesheetsGenerate a character's animation frames (idle, run, attack, death…) as one labeled pose board, then slice, key and pack them into an engine-ready spritesheet./animationMake 2D sprite animation read well: frame budgets per clip, timing and spacing, cancel windows, smears, secondary motion, wiring clips in Phaser. Generating frames is pixel-art / animated-spritesheets./asepriteParse Aseprite files (.ase/.aseprite) — layers, cels, tags, slices, palettes, tilesets — into JSON, durations and bounds for engines and tools.Other plugins' skills for the same job