Home

Awesome

QOI.jl - Implementation of the QOI (Quite OK Image) format

Build Statuscodecov

This Julia package contains a decoder and encoder for the QOI image format. The QOI format is very simple and can be faster than using PNG (see the benchmarks) at the cost of a slightly worse compression ratio.

The code here is based on the reference C implementation given in https://github.com/phoboslab/qoi.

FileIO API

This is the simplest API and likely the one that most should use. Simply, use the load/save API from FileIO.jl to load and save QOI images.

using FileIO
image = load("test.qoi")
save("test2.qoi", image)

Basic API

Advanced API

The QOI format is read in row-major order. This means that a transpose is required to create the matrices returned in the basic API. To avoid this, the following more advanced APIs exist:

Benchmarks

The benchmarks here compares the speed of encoding/decoding images with QOI.jl and PNGFiles.jl (which uses libpng) It is supposed to mimic https://qoiformat.org/benchmark/. The images used in the benchmark are taken from TestImages.jl, specifically, all the PNG images in https://testimages.juliaimages.org/stable/imagelist/. The benchmarks were run on Linux on a 12th Gen Intel(R) Core(TM) i9-12900K CPU. They can be repeated by running the benchmark/runbenchmarks.jl file with the associated environment.

<details><summary>Expand to see benchmark results</summary>

autumn_leaves.png 105x140 57.42kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles0.240.41233.52137.422.1838.6%
QOI0.040.131418.35425.1728.2549.2%

barbara_color.png 576x720 1215.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles9.0514.07131.1284.35812.8466.9%
QOI3.525.03337.19235.74945.7577.8%

chelsea.png 300x451 396.39kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles2.244.4172.8288.02218.8455.2%
QOI0.641.55605.92250.3233.2758.8%

coffee.png 400x600 703.12kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles5.3511.6128.2859.19443.1863.0%
QOI1.985.23346.76131.24493.370.2%

fabio_color_256.png 256x256 192.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles1.562.11119.8488.84118.061.5%
QOI0.540.86344.22216.96154.8680.7%

fabio_color_512.png 512x512 768.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles5.428.0138.4493.76327.4542.6%
QOI2.043.13366.9239.9463.960.4%

fabio_gray_256.png 256x256 192.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles1.081.65174.16113.7108.6556.6%
QOI0.380.78491.28239.687.9945.8%

fabio_gray_512.png 512x512 768.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles3.685.84203.88128.53259.4133.8%
QOI1.552.99483.08251.05298.2938.8%

lena_gray_16bit.png 256x256 192.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles1.121.7167.17109.98100.7152.5%
QOI0.40.78468.04241.282.0142.7%

lighthouse.png 512x768 1152.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles8.413.02133.9486.39692.5660.1%
QOI3.418.14329.92138.25638.7555.4%

monarch_color.png 512x768 1152.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles8.3613.34134.684.3613.2353.2%
QOI3.645.04309.24223.43715.7962.1%

monarch_color_256.png 256x256 192.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles1.242.3150.6581.55129.5267.5%
QOI0.341.46557.65128.6144.3975.2%

mountainstream.png 512x768 1152.0kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles8.813.46127.7883.6892.3477.5%
QOI3.054.41369.44255.16824.8371.6%

toucan.png 150x162 94.92kB

decode msencode msdecode mppsencode mppssize kbrate
PNGFiles0.340.58274.49158.8725.8427.2%
QOI0.060.181513.03514.7943.2845.6%
</details>