My tiny nibnib file was larger than the raw RGB image I fed into it.
For a 16×16 synthetic gradient, the raw RGB pixels took 768 bytes . The nibnib file took 1,220 bytes . Nothing had gone wrong with the encoder. The file had a palette to carry. 📦
That was the useful surprise in trying Raph Levien's image format: “4 bits per pixel” describes the compact pixel coding, not an all-inclusive promise for every file size.
What I Built
I made three original RGB gradients, ran the upstream nibnib encoder and decoder, and wrote an independent reader to check the decoded pixels.
Nibnib is aimed at constrained-device decoding. It works on pixel pairs and uses a palette of differences rather than just a palette of absolute colors.[1] The current interest in it makes a good excuse to inspect the bytes instead of borrowing the speed claim. 🔍
My check covers file layout and round trips. It doesn't measure microcontroller decoding speed.
Original synthetic input and actual decoded output.…