Description #
Piet is an esoteric programming language where programs are written as abstract images. Instead of traditional text-based code, colorful artwork is interpreted as executable logic. Named after the painter Piet Mondrian, Piet turns programming into visual art.
History #
Piet was created by David Morgan-Mar in 2001 as part of a series of joke languages. It leverages color transitions and block shapes to encode control flow and operations.
Key milestones:
- One of the first visual programming languages used purely for art
- Developed to challenge perceptions of what a programming language can look like
- Gained popularity in esolang communities for its blend of aesthetics and absurdity
- Has inspired coding contests and even NFT-style executable art
Hello World Code #
Because Piet is a visual language, its “Hello, World!” is an image. Here’s a link to a working sample:
Hello World Piet Image (Wikipedia)
The image contains carefully chosen color blocks that the Piet interpreter processes into output instructions.
How to Run #
Online: #
- Go to https://gabriellesc.github.io/piet/
- Upload the Hello World PNG
- Run the interpreter
Locally: #
- Download npiet (a popular interpreter)
- Save a
.png
Piet program - Run:
npiet hello.png
Key Concepts #
- Codels — blocks of the same color treated as a unit
- Color transitions — determine operations (e.g., light to dark = subtract)
- Direction pointers — move the “program counter” through the image
- Stack-based — Piet uses a stack for calculations and output
- No text — code is entirely image-based
- Commands by hue/shade change — combination of color direction and brightness
- Program control — shaped by block geometry
- I/O via stack — output is managed through pushes and pops
- Interpreters read pixels — color location and shift dictate behavior
- Turing-complete — despite being image-based, it’s fully capable of computation
Try It Online #
🔗 Piet Web IDE (Gabriel Lesch)
🔗 npiet Interpreter Download
🔗 TIO.run – Piet
Fun Facts #
- Named after artist Piet Mondrian, known for geometric art
- A valid Piet program can look like modern art but actually run
- Some artists have made generative art that runs as code
- Piet is Turing-complete and has been used to build working calculators
- There’s a version of Piet that works as a screensaver interpreter