QOI is an extremely simple file format with O(n) encoding/decoding performance.
See the original QOI implementation in C for more information.
interface QOIFile {
channels: number;
colorSpace: number;
imageData: ImageData;
}
-
channels
: Either3
for RGB or4
for RGBA. Note that theimageData
is always RGBA. This field just reports how many channels the decoded QOI file had (for decoding) or if the alpha channel shall be encoded (for encoded). -
colorSpace
: A bitmap 0000rgba where- a zero bit indicates sRGBA,
- a one bit indicates linear (user interpreted)
colorspace for each channel. Note that this library doesn't do any color space conversion.
-
imageData
: RGBA image data that can be used with a HTML canvas element.
function decodeQOI(input: ArrayBuffer): QOIFile
Decode QOI file provided as an ArrayBuffer
.
function encodeQOI(file: QOIFile): Uint8Array
Encode ImageData
as a QOI file.
- npm release