Programmer created a GIF image that prints its exact copy using the Piet Quine technique

Champion coder Yusuke Endoh continues to show off esoteric programming skills on social media. Their latest creation is called a Piet Quine, a GIF image that prints itself.

In other words, the GIF is both the code and the precise result of running that code.

To appreciate the scope of this feat, it helps to break down what Piet and Quine mean in a programming context. Piet is an esoteric programming language in which programs look like complex, colorful, tiled artwork. Inventor David Morgan-Mar named it after Piet Mondrian, the famous founder of the neoplasticism art movement.

https://www.youtube.com/watch?v=GwMtzhjCzyc

Such artwork is instantly recognizable thanks to bold squares and rectangles bordered by heavy black lines. Smaller Piet images do resemble Mondrian paintings a bit, though they also look a lot like colorful QR codes.

Endoh pulled off a Quine in graphical form. In programming, a Quine is a program that outputs a copy of its own source code without any external input. That alone can be a tricky task even within plain ASCII text.

The requirement for this kind of coding is that the output must be a character-for-character match of the input. The program also can't simply read its own file to perform the duplication.

Combining these two ideas multiplies the difficulty many times over. Endoh's blog post and the embedded video shed some light on the challenge and how it was solved. The video specifically shows the Piet Quine running.

The Piet interpreter scans the source GIF during the data-loading phase, then reads the GIF file header and palette information. What pushes this beyond a typical text Quine is that GIF files pack in binary data, compression, and a convoluted flow. All of these elements have to be handled deliberately to produce the desired result.

It's worth understanding that the source image contains a separately interpreted data section, compressed using adaptive run-length encoding, along with a code section. Endoh said they first pulled this off back in 2009, but that GIF ended up very tall, which hurt its visual appeal.

Endoh decided to enlist Claude Code to analyze and reconstruct the original script and build a landscape-oriented Piet Quine. Even with AI assistance, refining the design down to the compact finished GIF shown in the video wasn't easy.

Only after extensive work trimming the visuals and guiding Claude did the image fit into its final 4:3 format, measuring 252 x 189 pixels.

Endoh said the main motivation behind the Piet Quine project was to draw attention to the 2026 Obfuscated Programming Language Design Contest, which is currently open.

Anyone interested is encouraged to design an esoteric programming language and submit an entry. Endoh is one of the judges, and submissions are open until October 1.

More news
Tags: