Nibnib says 4bpp. The file still has a header.
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โฆ
My tiny nibnib file was larger than the raw RGB image I fed into it. The file had a palette to carry, despite the "4 bits per pixel" description. I created three original RGB gradients and ran the upstream nibnib encoder and decoder, checking the decoded pixels with an independent reader. Nibnib aims at constrained-device decoding and works on pixel pairs, using a palette of differences rather than absolute colors.
When I checked file layout and round trips, the nibnib file size for a 16ร16 synthetic gradient was 1,220 bytes, while the raw RGB pixels took 768 bytes. The file stored dimensions and a fixed palette before its row data, with each row starting with an explicit pixel pair and later pairs using palette indices. The rows were aligned to four-byte boundaries.
The file size calculation for positive, even widths was provided, and the checked sizes across three fixtures were compared to uncompressed RGB. The demonstration used nibnib version 0.1.0, and the independent reader followed the documented layout and checked decoder source.
Written by urgent.news from Dev.to's reporting โ not their text. Machine-written โ may contain errors; check the original before relying on it.