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: Either3for RGB or4for RGBA. Note that theimageDatais 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): QOIFileDecode QOI file provided as an ArrayBuffer.
function encodeQOI(file: QOIFile): Uint8ArrayEncode ImageData as a QOI file.
- npm release