QOI

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

QOI

Post by Kjell »

8)

Attached is a QOI decoder including a simple demo that loads a external QOI image containing a single frame of the selected fighter into a texture. Obviously this makes more sense when the images you're loading are a lot bigger than in this example, but the approach would remain the exact same.

Image

Use the arrow keys to select a fighter.

K
Attachments
QOI.zip
(69.47 KiB) Downloaded 603 times
User avatar
VilleK
Site Admin
Posts: 2324
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: QOI

Post by VilleK »

That is very neat! I've been keeping an eye on this format and your implementation looks solid. With a cool demo as usual :)

What kind of compression ratio do you get for the included images?
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Re: QOI

Post by Kjell »

Hej Ville,
VilleK wrote: Mon May 23, 2022 7:15 amWhat kind of compression ratio do you get for the included images?
It varies from situation to situation, but in this case the original PNG images were 59228 bytes total, while the QOI images are only 36970 bytes. Due to the limited color palette & large number of masked pixels most of the data-chunks are either RLE or indexed which explains the impressive compression ratio.

K
User avatar
VilleK
Site Admin
Posts: 2324
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: QOI

Post by VilleK »

Kjell wrote: Mon May 23, 2022 7:37 am original PNG images were 59228 bytes total, while the QOI images are only 36970 bytes.
That is impressive indeed. When I read the QOI spec I thought well this looks nice and simple but it will surely be much worse compression than PNG for most pictures. But it turns out it is really quite ok as a general image format. The simplicity makes it super fast and the implementation very compact.

A bold move by the author to ignore the complexity of modern formats and just go back to basics.
Post Reply