Skip to main content

@img/qoi@0.1.1
Built and signed on GitHub Actions

A image encoder/decoder for the QOI format

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
4 hours ago (0.1.1)

This is a TypeScript implementation of the .qoi image format. The module provides two TransformStream classes to encode and decode ReadableStream<Uint8Array> in the desired format. The raw pixel format pipped into the encoder is expected to be a repeating sequence of [ r, g, b, a ]. This is also the format that is pipped out of the decoder. This implementation is based off the QOI Specification. You can find about more about QOI at their website: https://qoiformat.org/.

Examples

Example 1

import { QOIEncoderStream } from "@img/qoi";

await ReadableStream
  .from(async function* () {
    for (let r = 0; r < 256; ++r) {
      for (let c = 0; c < 256; ++c) {
        yield Uint8Array.from([255 - r, c, r, 255]);
      }
    }
  }())
  .pipeThrough(
    new QOIEncoderStream({
      width: 256,
      height: 256,
      channels: "rgb",
      colorspace: 0,
    }),
  )
  .pipeTo((await Deno.create("image.qoi")).writable);
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@img/qoi

Import symbol

import * as mod from "@img/qoi";

---- OR ----

Import directly with a jsr specifier

import * as mod from "jsr:@img/qoi";

Add Package

npx jsr add @img/qoi

Import symbol

import * as mod from "@img/qoi";

Add Package

yarn dlx jsr add @img/qoi

Import symbol

import * as mod from "@img/qoi";

Add Package

pnpm dlx jsr add @img/qoi

Import symbol

import * as mod from "@img/qoi";

Add Package

bunx jsr add @img/qoi

Import symbol

import * as mod from "@img/qoi";