Skip to content

🖼️ QOI codec written in JavaScript, a faster alternative to PNG

License

Notifications You must be signed in to change notification settings

RickyC0626/qoi.js

Repository files navigation

🖼️ qoi.js

QOI codec written in JavaScript.

GitHub Workflow Status (with event) npm GitHub License
GitHub repo size GitHub code size in bytes

Built with

Node.js Node.js Sharp Sharp Jest Jest

Installation

Install package

yarn add @rickyc0626/qoi.js

Using the QOI API

const { QOI } = require('@rickyc0626/qoi.js');

const header = { width, height, channels, colorspace };
const encoded = QOI.encode(new Uint8Array(rawPixels), header);
const decoded = QOI.decode(buffer);

Using the PNG <--> QOI Converter

qoi.js CLI for PNG <--> QOI conversion

Usage:

qoi encode <infile> [outfile]
qoi decode <infile> [outfile]

Examples:
  qoi encode input.png output.qoi
  qoi decode input.qoi output.png

Run the following, outfile is optional. By default any encoded / decoded files will be generated in /out.

node src/qoi encode file.png
node src/qoi decode file.qoi