This repository contains an implementation of the QOI (Quite OK Image) format in the Jai programming language.
QOI is fast. It losslessly compresses images to a similar size of PNG, while offering 20x-50x faster encoding and 3x-4x faster decoding.
- Compliant with the latest QOI format specification.
- Clean and minimal codebase for easy understanding and modification.
QOI_STDIO :: true; // qoi_write() and qoi_read()
#load "qoi.jai";
Qoi_Desc desc = .{
width = ...,
height = ...,
channels = ...,
colorspace = ...,
};
bytes, ok := qoi_encode(pixels, desc);
bytes := qoi_encode(pixels, desc); // checking the result is optional
or
bytes, ok := qoi_encode(pixels, width, height, channels, colorspace);
bytes, ok := qoi_encode(pixels, width, height); // channel and colorspace are optional
pixels, desc, ok := qoi_decode(bytes);
pixels, desc, ok := qoi_decode(bytes, 4); // preferred channels, 3: RGB, 4: RGBA
Qoi_Desc desc = .{
width = ...,
height = ...,
channels = ...,
colorspace = ...,
};
len := qoi_write(filename, pixels, desc);
qoi_write(filename, pixels, desc); // getting the bytes count writed is optional
or
qoi_write(filename, pixels, width, height, channels, colorspace);
qoi_write(filename, pixels, width, height); // channel and colorspace are optional
pixels, desc, ok := qoi_read(filename);
pixels, desc, ok := qoi_read(filename, 4); // preferred channels, 3: RGB, 4: RGBA
This project is licensed under the MIT License. See the LICENSE file for details.