Skip to content

implementation of the QOI (Quite OK Image) image format in the Jai programming language.

License

Notifications You must be signed in to change notification settings

666rayen999/qoi-jai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

QOI Implementation in Jai

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.

Features

  • Compliant with the latest QOI format specification.
  • Clean and minimal codebase for easy understanding and modification.

Usage

QOI_STDIO :: true; // qoi_write() and qoi_read()
#load "qoi.jai";

Encoding

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

Decoding

pixels, desc, ok := qoi_decode(bytes);
pixels, desc, ok := qoi_decode(bytes, 4); // preferred channels, 3: RGB, 4: RGBA

Reading from file

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

Writing to file

pixels, desc, ok := qoi_read(filename);
pixels, desc, ok := qoi_read(filename, 4); // preferred channels, 3: RGB, 4: RGBA

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

implementation of the QOI (Quite OK Image) image format in the Jai programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published