SSJX.CO.UK
Content

Porting the Quite Okay Image Encoder to the D Programming Language

Introduction

This page details my porting of the Quite Okay Image (QOI) format encoder to the D Programming Language. The QOI format was created by Dominic Szablewski as a fast, easy to understand lossless image format. I was able to include the decoder in my Viewer program and thought it would be good to make an encoder as well!

Download

To keep the download size small, this is provided as a 7zip archive. Archive includes the compiled exe and source.

Porting to the D Programming Language

Given that the compression method and encoder are relatively simple, there were no radical changes in the conversion, more a case of tiny tweaks to get some benefits that the D Language provides:

Final Result

As final check, a CRC checksum tells me that the files this creates are identical to IrfanView which is a good sign. This version was not made for speed but as an easy to understand reference version. As it works well, it will probably be the basis of encoders for my Java and C# applications too!

Benchmarks

These numbers should be taken with a pinch of salt but just to give some idea of comparison:

Test Bitmap
Resolution: 1296 x 1336 x 3 (24bit)
File Size: 5833KB

BMPQOIPNG
Compression Time (ms)n/a123n/a
File Size (KB):583327291976
Time to open (IrfanView):16ms94ms234ms

Conclusions

This encoder works and is reasonably quick. The QOI format looks like a good one to use if an application needs a simple way to add a lossless image save option!

Created 07/07/2024