X PixMap

Code editor

Live output

Viewer

The plaid demo is the example from the XPM manual.

Why this exists

Serializable pixel art

Hey, I made this because I’m interested in serializable pixel art. While looking into it, I found the X PixMap specification.

XPM was used for icons and interface graphics in the X Window System, with images stored as plain text that could even be embedded directly in C source code. I thought that was really cool.

After some quick searching, I couldn’t find a simple editor for it, so I brought this seemingly unused specification back to life.

Format basics

Quick XPM tutorial

1

Start with ! XPM2. Lines beginning with ! are comments.

2

Define the image with width height colors chars-per-pixel. For example, 10 10 3 1.

3

Add exactly that many color lines, such as X c black or . c None.

4

Write one pixel row per image row. Each row must contain width × chars-per-pixel characters.

Adding a color? Add its definition, increase the header’s color count, then use its symbol in the pixel rows. In this editor, documents with ! colors and ! pixels markers are kept in sync automatically.