I implemented a QOI encoder in ~160 lines of very pedantic and paranoid Zig code (many assertions). It's indeed quite ok.