CLI Reference

The pixl command-line tool renders, validates, generates, and exports pixel art from .pax files.

Note
Every command that takes FILE expects a .pax file — your tileset, project file, and source of truth all in one. See PAX Format for the full spec, or run pixl new dark_fantasy -o my_tileset.pax to create one.

The .pax file

To create your first .pax file:

pixl new dark_fantasy -o my_tileset.pax

This generates a starter file with a palette, theme, and a few example tiles. You can also write one by hand in any text editor.

Workflow overview

A typical session looks like this:

# 1. Create a tileset from a template
pixl new dark_fantasy -o dungeon.pax

# 2. Edit dungeon.pax in a text editor or Studio — add tiles

# 3. Validate your work
pixl validate dungeon.pax

# 4. Render a tile to check it visually
pixl render dungeon.pax --tile wall_solid --scale 8 --out wall.png

# 5. Generate a map from your tiles
pixl narrate dungeon.pax --width 12 --height 8 --out map.png

# 6. Pack everything into a sprite atlas for your game
pixl atlas dungeon.pax --out atlas.png --map atlas.json --scale 2

# 7. Export to your game engine
pixl export dungeon.pax --format tiled --out ./export/

Command reference

Creating tilesets

CommandWhat it does
pixl new THEME -o FILECreate a .pax file from a built-in theme template. Themes: dark_fantasy, light_fantasy, sci_fi, nature, gameboy, nes.

Rendering

CommandWhat it does
pixl render FILE --tile NAME --scale N --out PATHRender a single tile to PNG. Scale multiplies the pixel size (e.g., --scale 8 makes each pixel 8x8 on screen).
pixl preview FILE --tile NAME --out PATH [--grid]16x zoom preview. Add --grid for pixel grid overlay.
pixl render-sprite FILE --spriteset NAME --sprite NAME --out PATHRender an animated sprite as GIF or PNG spritesheet.
pixl render-composite FILE --composite NAME --out PATHRender a composite sprite. Add --variant or --anim/--frame for specific poses.

Validation & quality

CommandWhat it does
pixl validate FILECheck for errors: broken palettes, wrong grid sizes, missing tiles.
pixl validate FILE --check-edgesAlso check WFC edge compatibility between tiles.
pixl validate FILE --check-seamsCheck pixel continuity at composite tile boundaries.
pixl validate FILE --completenessFind missing transition tiles for WFC.
pixl check FILE --fixAuto-detect edge classes from pixel content and write them into the file.
pixl check FILE --subcompleteVerify sub-completeness: every edge class appears on both sides of each axis. If sub-complete, WFC is mathematically guaranteed contradiction-free.
pixl critique FILE --tile NAMEStructural quality analysis: outlines, centering, contrast, fragmentation. Prints a verdict (ACCEPT / REFINE / REJECT).

Generation

CommandWhat it does
pixl generate-sprite FILE --prompt "..." --name NAME --out PATHGenerate a sprite via DALL-E + palette quantization. FILE provides the palette. Requires OPENAI_API_KEY env var.
pixl narrate FILE --width W --height H -r "RULE" --out PATHGenerate a WFC map. Rules: "border:wall", "region:boss:floor:3x3:southeast", "path:0,3:11,3".
pixl vary FILE --tile NAME --count NCreate N mutations of a tile (cracks, shifts, noise) while preserving edge compatibility.
pixl upscale FILE --tile NAME --factor 2 --out PATHNearest-neighbor upscale: 8x8 → 16x16. Prints the upscaled grid for copy-paste.
pixl blueprint SIZEShow character anatomy landmarks for a canvas size (e.g., 32x48).

Image conversion

These commands convert existing images into PAX pixel art. The input is an image file (PNG, JPG, etc.), not a .pax file.

CommandWhat it does
pixl convert IMAGE --width W --colors NConvert any image to pixel art. Downscales + quantizes colors.
pixl import IMAGE --size WxH --pax FILE --palette NAMEQuantize an image using a specific palette from a .pax file.
pixl backdrop-import IMAGE --name NAME --colors N --tile-size T -o FILEConvert an image into a PAX backdrop with tiled layers.

Atlas & export

CommandWhat it does
pixl atlas FILE --out PATH --map JSON [--columns N] [--scale N]Pack all tiles into a sprite atlas PNG + TexturePacker JSON metadata.
pixl export FILE --format FORMAT --out DIRExport to a game engine. Formats: tiled, godot, unity, texturepacker, gbstudio.

Style

CommandWhat it does
pixl style FILEExtract an 8-point style fingerprint from your tiles (light direction, density, shadow ratio, etc.).

PAX-L (compact format)

CommandWhat it does
pixl compact FILEConvert a .pax file to PAX-L compact format (stdout). ~40% fewer tokens than TOML.
pixl compact FILE --no-stampsSkip auto-stamp extraction (faster, slightly less compact).
pixl compact FILE --no-row-refsDisable =N row references.
pixl compact FILE --no-fillDisable @fill pattern detection.
pixl expandConvert PAX-L from stdin back to .pax TOML. Pipe: pixl compact f.pax | pixl expand.
pixl expand --strictStrict parsing mode — rejects any structural error (default is lenient).

Style Scanner

Scan reference art, prepare training data, and train a LoRA adapter. See Style Scanner for the full guide.

CommandWhat it does
pixl scan INPUT --out DIRScan images or sprite sheets, extract quality-filtered patches. Auto-detects background colors, tile boundaries, and categories.
pixl scan DIR --stride 8Overlapping patches for more training data.
pixl scan IMAGE --tile-size 32Grid-based tilesets (e.g., 32x32 tiles resized to 16x16).
pixl prepare SCAN_DIR --out DIR --style NAMEPrepare training data from scanned patches. Quantizes to PAX, augments, stratifies.
pixl prepare SCAN_DIR --out DIR --color-aug --aug 8Full augmentation: 8x geometric + 3x color shifts.
pixl train DATA_DIR --adapter DIRTrain a LoRA adapter on prepared data. Runs locally on Apple Silicon via mlx-lm.
pixl train DATA_DIR --adapter DIR --epochs 10 --resumeResume training with more epochs.
pixl train DATA_DIR --sources eotb_optimal,matched --adapter DIRMerge multiple data_* directories, deduplicate, and train on the combined set.
pixl train DATA_DIR --exclude eotb_walls --adapter DIRTrain on all datasets except the excluded ones.
pixl retrain FILE --adapter DIR --style NAMEOne command: export tiles from .pax → prepare training data → train adapter. Uses your tileset as the training source.
pixl generate-set FILE --set-type walls --theme dark_fantasy --count 5 --out DIRGenerate a coherent set of tiles (walls, floors, enemies, items). Uses the trained adapter for style-consistent output.
pixl generate-set FILE --set-type enemies --adapter DIR --count 3 -o DIRGenerate enemy sprites with a specific adapter.
pixl datasets [--dir DIR]List available training datasets with sample counts, style tags, and source info.
pixl adapters [--dir DIR]List available LoRA adapters with metadata (name, samples, epochs).
pixl compare FILE --prompt "..." --adapter-a A --adapter-b B -o FILEGenerate the same tile with two adapters, render side by side.
pixl blend-style FILE_A FILE_B [--blend 0.5]Blend two style latents. Shows distance (0=identical, 1=very different) and interpolated properties.

Full workflow:

pixl scan my_sprites/ --out my_scan --stride 8
pixl prepare my_scan/ --out my_data --style my-game --color-aug
pixl train my_data --adapter my_adapter --epochs 5
pixl serve --adapter my_adapter --file project.pax

Servers

CommandWhat it does
pixl mcp --file FILEStart the MCP server for AI assistants. Connects via stdio — Claude Code and other MCP clients detect it automatically.
pixl serve --port 3742 --file FILEStart the HTTP API server for Studio or custom integrations. FILE is the .pax tileset to load into the session.

Common flags

FlagWhat it does
--scale NRender scale factor. Each pixel becomes NxN on screen.
--out PATH / -o PATHOutput file or directory.
FILE (positional)Input .pax file. This is your tileset.
--tile NAMEWhich tile to operate on (by name from the .pax file).