The QOI File Format Specification
Last month I announced a toy project called QOI — the Quite OK Image Format. It losslessly compresses RGB and RGBA images to a similar size of PNG, while offering a 20x-50x speedup in compression and 3x-4x speedup in decompression.
With the help of countless passionate people on Github, we have refined some of the rough edges and specified exactly what a valid QOI file is. QOI is now faster, compresses better and is even simpler.
The final QOI-Specification fits on a single-page PDF. More information and benchmark results can be found on qoiformat.org. The source is on github.
Getting here was not easy. There were more than 500 comments on the github page, with a mixture of careful analysis, interesting proposals and heated discussions. Everyone has different ideas of what an image format should be able to do and how it should do it. In the name of simplicity, I rejected many of those.
QOI will not compress images as well as an optimized PNG encoder and that's OK. We already have image formats that out-compress PNG anyway. QOI's virtue is in its simplicity.
Adoption
In the last few weeks QOI implementations for lot of different languages and libraries popped up. Including Zig, Rust, Rust, Rust, Go, TypeScript, Haskell, Ć, Python, C#, Elixir, Swift, Java and Pascal and wrappers for Python and Lua.
There is a native application to view qoi files, plugins for Gimp, Paint.NET and XNView MP, support in SDL_Image (pending) and many more.
(Note that not all of these have been updated to the final spec yet.)
With all this going on, it looks like QOI might actually end up being a thing. I don't expect it to appear in web browsers, where compression ratio is much more important, anytime soon. But there are use-cases in games or other applications where the performance benefits certainly make sense.
The Specification
The main changes from the initial release are:
- all data is now encoded as big-endian.
- addition of a
channels
andcolorspace
header. These are only informative and don't change the behavior of the en-/decoder in any way. - removal of the
size
header. This allows for a streaming encoder without having to jump back to set the size in the file header. width
andheight
fields are now 32bits.- the data format has been reduced to just 6 different chunks.
If you have a minute, please have a look at the QOI File Format Specification.
Thanks <3
I'm tremendously thankful for all the comments on github. Even if many ideas weren't implemented, they showed an interesting direction that a Quite Good Image Format could take. And I'm very happy that QOI sparked that research.
Again, thanks to everyone who wrote an implementation, commented on github or just shared this with others! It's been a wild ride.