Overview

Pix is a language for drawing pixel art. You define a grid, write expressions over x and y coordinates or use built-in shape shortcuts, and export the result as a PNG image.

grid 17 by 17

color {
    warm: #e84a00
}

circle (5, 5) radius 4 with color warm
circle (11, 5) radius 4 with color warm
triangle (1, 7) to (15, 7) to (8, 15) with color warm

export "heart" in png scale 8
Heart
A heart built from two circles and a triangle

How it works

The pipeline reads a .pix source file, tokenizes it, parses it into an abstract syntax tree, evaluates expressions for every pixel position on the grid, renders matching pixels, and exports the result as a scaled PNG.

  1. A grid statement sets the canvas size.
  2. An optional color block defines named colors.
  3. draw, erase, clear, and shape statements compose the image.
  4. One or more export statements save the result.

Language at a glance

FeatureSyntax
Canvasgrid <w> by <h>
Draw by expressiondraw <condition> with <color>
Eraseerase <condition>
Clearclear
Shapespixel, line, rectangle, triangle, circle
Named colorscolor { name: #hex }
Exportexport "name" in png scale <n>
Comments// comment