This tiny C program outputs a 128x128 RGB image file to the standard output using the portable pixmap file format (PPM). The output looks like:
The uncompressed image is 12 times larger than the source code of the program which includes the image data and the complete decoder. The actual image data is 1220 byte long, which gives a compression ratio of 40. Using a JPEG-like algorithm would not be enough to reach this level of compression (the Lena image would be barely recognizable). So the algorithm is based on the latest advances in image compression. It includes the following features:
Those interested by the inner working of the program can read A Tour of the Tiny and Obfuscated Image Decoder by Andrew Kensler.
The DCT transform is based on integer coefficients to avoid rounding errors. However I had not enough space to precompute them in the IOCCC entry so they were computed each time with a floating point expression which explains most of the slowness of the decoding. With comments from László Papp and Alex Rhatushnyak I updated the program to precompute the inverse DCT coefficients: prog.c. The result is a much faster decoding while still complying with the IOCCC size constraints. As the original IOCCC entry, it can be compiled and run under Linux with:
gcc -O2 prog.c -o prog -lm ./prog > lena.ppmHere is the corresponding deobfuscated version: ld.c, img.h.