The first pixel art format designed for GenAI.
pixelsrc is a semantic, human-readable text format for defining pixel art. Unlike traditional editors or hex-based formats, it's designed from the ground up for AI systems to generate reliably.
// coin.pxl - A simple coin sprite
{
type: "palette",
name: "coin",
colors: {
_: "transparent",
outline: "#8B6914",
gold: "#FFD700",
shine: "#FFFACD",
},
}
{
type: "sprite",
name: "coin",
size: [8, 8],
palette: "coin",
regions: {
_: "background",
outline: { stroke: [1, 1, 6, 6], round: 2 },
gold: { fill: "inside(outline)" },
shine: { points: [[3, 2], [4, 3]] },
},
}- Semantic regions - Define shapes like
rect,circle,fillinstead of individual pixels - Context-efficient - 64x64 sprites take the same space as 8x8 with similar structure
- GenAI-native - Describe intent, the compiler resolves pixels
- JSON5 format - Comments, trailing commas, unquoted keys for readability
- Lenient by default - Fills gaps and continues on small errors; strict mode available for CI
brew install scbrown/tap/pixelsrccargo install --git https://github.com/scbrown/pixelsrcPre-built binaries for Linux, macOS, and Windows are available on the Releases page.
- Create a file
hero.pxl:
{
type: "palette",
name: "hero",
colors: {
_: "transparent",
outline: "#000000",
skin: "#FFD5B4",
hair: "#8B4513",
eye: "#4169E1",
},
}
{
type: "sprite",
name: "hero",
size: [16, 16],
palette: "hero",
regions: {
_: "background",
"head-outline": { stroke: [4, 2, 8, 10], round: 2 },
hair: { fill: "inside(head-outline)", y: [2, 5] },
skin: { fill: "inside(head-outline)", y: [5, 12], except: ["eye"] },
eye: { rect: [6, 7, 2, 2], symmetric: "x" },
},
}- Render it:
pxl render hero.pxl -o hero.png- Scale it up:
pxl render hero.pxl -o hero.png --scale 8| Command | Description |
|---|---|
pxl render <file> |
Render .pxl to PNG |
pxl render --gif |
Export animations to GIF |
pxl render --spritesheet |
Generate sprite sheets |
pxl fmt <files> |
Format files for readability |
pxl validate <file> |
Check for errors |
pxl palettes list |
List built-in palettes |
pxl import <image> |
Convert PNG to .pxl |
- Palettes - Define reusable color schemes with semantic roles
- Sprites - Define images using geometric regions
- Regions - Shapes:
rect,stroke,circle,ellipse,polygon,fill - Modifiers -
symmetric, range constraints (x,y),except - Animations - Frame sequences with timing
- Compositions - Layer sprites into scenes
- State Rules - Visual states without separate sprites
- Web Editor - Live editor with real-time preview
- WASM Module - Use in JavaScript/TypeScript
- Obsidian Plugin - Render sprites in your notes
This project uses just as a command runner:
just --list # Show all available commands
just build # Build the project
just test # Run tests
just check # Run format check, lint, and tests
just render coin # Render an example sprite- Documentation Book - Complete user guide with interactive examples
- Format Specification - Complete format schema
- AI Primer - Guide for AI generation
- Implementation Plan - Roadmap and phase status
- Vision & Philosophy - Design principles
- Contributing - Development guide
- Game development - Generate sprites with AI assistants
- Prototyping - Quick iteration on visual assets
- Version control - Text-based diffs for pixel art
- Education - Learn pixel art through readable definitions
MIT - see LICENSE