Skip to content

Recipes

m4bwav edited this page Dec 3, 2026 · 1 revision

Short, tested routes for jobs that come up often. Each one is a few pxw.py commands in order. Every command prints JSON and exits 1 when a gate fails, so a script or an agent can stop at the first failure. pxw.py stands for skills/pixelwright/scripts/pxw.py. All commands on this page were run against 1.0.0 on 2026-12-03.

Contents:

A game sprite from an image model's render

The render looks like pixel art but has thousands of colours, a soft grid and a background. One recipe does every step:

{"id": "mushroom", "input": "render.png", "palette": 8,
 "clean": {"orphans": true, "outline": "selective"}, "crop": {"pad": 1, "size": "32x32"}}
python pxw.py make recipe.json out

out/mushroom.png is the sprite, out/mushroom.gpl its palette, and the JSON ends with the gates (alpha_binary, colours_outside_palette, within_budget, size_ok).

Render Sprite (8x)
render sprite

When the grid is wrong, look at it alone first: python pxw.py snap render.png snapped.png reports the scale and offset it found. If the render is flat hi-res art with no grid at all, use pixelize instead: python pxw.py pixelize art.png out.png --height 32 --colours 12. To see whether a sprite still carries generator tells (speckle, even detail, an exact mirror), run python pxw.py tells out/mushroom.png. More: Making pixel art.

Match a sprite to the rest of the set

Give the recipe the sprites it must sit beside, and every colour comes from them:

{"id": "potion", "input": "render.png", "palette": "from:chest.png,key.png", "crop": {"pad": 1, "size": "32x32"}}

To recolour a finished sprite instead of making a new one, swap maps colours one to one. More: Palettes.

A Game Boy or PICO-8 version

python pxw.py palette out/mushroom.png pico.png --palette pico-8
python pxw.py fit pico.png --target gb

fit reports the tile and colour budget of the target console and exits 1 with cells_over when the image is outside it. A PICO-8 sprite usually is: the Game Boy allows 4 colours per 8x8 cell.

PICO-8 version

A seamless tile, then an isometric one

python pxw.py tile grass.png grass-tile.png
python pxw.py iso grass-tile.png grass-iso.png --scale 2

tile wraps the edges using only the texture's own colours; iso turns the square into a 2:1 diamond, also with no new colours.

Before, tiled 3x3 After tile After iso
seams no seams iso

A colour ramp that does not go chalky

python pxw.py ramp --base 3a7bd5 --steps 6 --gpl blue.gpl
python pxw.py ramp --check blue.gpl

The ramp leans lights towards yellow and darks towards blue-violet. --check flags ramp_chalky when the top step loses its colour.

ramp

An idle loop from one still

python pxw.py idle-breathe knight.png idle --frames 8 --neck-row 8 --chest-row 11 --hip-row 15 --name knight
python pxw.py loopcheck idle

The chest rows widen and settle; the head and legs do not move a pixel. loopcheck reads the frames in idle/ (since 1.0.0 it skips the strip saved beside them) and fails a seam or a jump frame. For a sleeping or dead character, breathe does the same from a prone frame and adds a "z". For anything more than breathing, write a brief: Animating a sprite.

idle breath

Clean a model's effect GIF into one sheet

A video or image model's explosion GIF has its own grid, drifting colours and a background. anim puts every frame on one grid and one palette and pins them to a sheet (fx/boom_sheet.png and .json); fxcheck then checks that a one-shot ends empty, nothing is clipped at the edges and no frame is a duplicate:

python pxw.py anim boom.gif fx --name boom --colours 12
python pxw.py fxcheck fx/boom_sheet.json

If anim finds no shared grid (soft "HD pixel art" has none), measure one art pixel on a zoomed frame and pass --scale. For loops, add --find-loop to anim and --loop to fxcheck. Before generating an effect at all, check whether a ready-made pixelfx effect fits; the make skill lists that route first.

Lights, shadows and rotations for an engine

python pxw.py normals out/mushroom.png nrm --relit
python pxw.py shadow out/mushroom.png shadow
python pxw.py rotate out/mushroom.png rot30.png --deg 30

normals writes a normal map (OpenGL green-up by default, --green-down for DirectX) and, with --relit, a preview lit from the upper left. shadow writes a drop-shadow sprite and a feet anchor for Phaser, Godot and Unity. rotate uses RotSprite and adds no colours.

normals --relit rotate --deg 30
normals rotated

Ship: atlas, Aseprite, tileset

python pxw.py atlas atlas.png out/mushroom.png pico.png rot30.png
python pxw.py aseprite idle.aseprite idle/knight_?.png --tag idle:0-7
python pxw.py tileset level.png tiles --cell 16 --flip

atlas shelf-packs mixed sizes into pages with TexturePacker hash JSON and extruded edges. aseprite writes a tagged .aseprite file. tileset removes duplicate cells (flips count as duplicates with --flip) and writes tiles.png and tilemap.json.

Every picture on this page comes from .github/images/gallery/make_gallery.py in the repository, which draws the inputs in code.

Clone this wiki locally