The Quite Ok Image Format

Sometimes simplicity and elegance are indistinguishable from each other

Images captured by say a camera or screenshot are ultimately transposed into a large array of raw Red, Green and Blue (RGB) pixel brightness values. To store this unprocessed data is costly and not nearly nerdy enough, hence your camera images or screenshots are encoded into an image format; say JPG or PNG. The key difference between these leading formats is that JPG will discard data whilst retaining as much visual similarity as possible (lossy), whereas PNG does some fancy compression to minimise file size, yet retain all information (lossless).

Have you heard of QOI, the "Quite Ok Image" format? I hadn't either. QOI is an O(n) lossless image format with comparable file sizes to PNG but boasts 20-50x faster encoding and 3-4x faster decoding. Its edge is in its simplicity. The PNG specification is oodles of pages long, whereas the QOI spec fits on a single A4 page. QOI was released just this year (2022) - 30 years after the PNG spec was released.

What I find fascinating is that this simple encoding scheme never crossed anyone's mind for the last 30 years only to be made by someone that says:

I have no idea what I’m doing. I’m not a compression guy

There's some soppy comment to be made here about how everything should be questioned on its room for improvement, you needn't be an expert in the area; but that inference is left as an exercise to the reader.

Hell, I'm no formal developer or image processing guru, but the spec is so short and clear even I was able to write a sample Python encoder in under 68 lines of code. Throw it a .png (yes, the irony is not lost on me, but do you have a raw RGB stream sitting around?) and out comes a .qoi. If you're looking to gloat (as I admittedly was) that you wrote an image encoder from scratch, I suggest you pull up the spec and attempt your own implementation.

Now... if only someone could perform a similar revamp on the behemoth that is the PDF spec[1]...