npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@catlabtech/webcvt-image-jsquash-jxl

v0.2.0

Published

JPEG XL (JXL) decode/encode for webcvt — lazy-loads @jsquash/jxl wasm, plugs into the image adapter pipeline

Readme

@catlabtech/webcvt-image-jsquash-jxl

JPEG XL (JXL) decode/encode adapter for webcvt. Wraps @jsquash/jxl (libjxl, compiled to WebAssembly) with lazy wasm loading, typed errors, and a clean opt-in registration API.

JPEG XL is a modern, royalty-free raster codec supporting both lossy and mathematically-lossless compression, wide gamut, and progressive decoding.

License notice

This package (@catlabtech/webcvt-image-jsquash-jxl) is MIT licensed.

The peer dependency @jsquash/jxl bundles libjxl (BSD-3-Clause). JPEG XL is a royalty-free standard (ISO/IEC 18181). @jsquash/jxl is an optional peer dependency, so installing the wasm codec is explicit and intentional.

Installation

npm install @catlabtech/webcvt-image-jsquash-jxl
# plus the wasm codec (optional peer):
npm install @jsquash/jxl

Usage

Opt-in registration (recommended)

import { registerJxlBackend } from '@catlabtech/webcvt-image-jsquash-jxl';

// Register with the default process-wide registry.
// Wasm is NOT loaded at this point — it loads lazily on the first convert().
registerJxlBackend();

With a custom registry

import { BackendRegistry } from '@catlabtech/webcvt-core';
import { registerJxlBackend } from '@catlabtech/webcvt-image-jsquash-jxl';

const registry = new BackendRegistry();
registerJxlBackend(registry, { encode: { quality: 80, effort: 5 } });

Free functions (lower-level API)

import {
  decodeJxl,
  encodeJxl,
  preloadJxl,
  disposeJxl,
} from '@catlabtech/webcvt-image-jsquash-jxl';

await preloadJxl();                 // warm up wasm (optional)
const imageData = await decodeJxl(jxlBytes);
const encoded = await encodeJxl(imageData, {
  quality: 80,      // 0–100 (higher = better), default 75. 100 ≈ visually lossless
  effort: 5,        // 1–9 (higher = slower/smaller), default 7
  lossless: false,  // true = mathematically lossless (ignores quality)
  progressive: false,
});
disposeJxl();                       // free wasm memory when done

canHandle matrix

The backend gates strictly to conversions where JXL is on at least one side:

| Input | Output | Supported | Notes | |-------|--------|-----------|-------| | JXL | JXL | yes | Re-encode / quality adjustment | | JXL | PNG / JPEG / WebP | yes* | jsquash decode + canvas bridge | | PNG / JPEG / WebP | JXL | yes* | canvas bridge + jsquash encode | | PNG | JPEG | no | Use @catlabtech/webcvt-image-canvas |

* Pixel-bridge paths require OffscreenCanvas (or HTMLCanvasElement + document). In Node without a canvas implementation, only JXL→JXL is available.

Encode options

interface JxlEncodeOptions {
  quality?: number;       // 0–100 (higher = better), default 75
  effort?: number;        // 1–9 (higher = slower/smaller), default 7
  lossless?: boolean;     // default false; when true, quality is ignored
  progressive?: boolean;  // default false
}

Unlike AVIF (which uses an inverted cqLevel), JPEG XL's quality scale is direct.

Security limits

| Limit | Value | Error | |---|---|---| | Max input bytes | 256 MiB | JxlInputTooLargeError | | Max pixel count | 25 MP | JxlDimensionsTooLargeError |

CSP requirements

The @jsquash/jxl wasm binary requires script-src 'wasm-unsafe-eval'. The multi-threaded codec variant additionally needs the page to be cross-origin isolated (Cross-Origin-Opener-Policy: same-origin + Cross-Origin-Embedder-Policy: require-corp); it transparently falls back to the single-threaded codec otherwise.

Error types

| Class | Code | When | |---|---|---| | JxlLoadError | JXL_LOAD_FAILED | @jsquash/jxl not installed or wasm fetch failed | | JxlDecodeError | JXL_DECODE_FAILED | malformed or unsupported JXL data | | JxlEncodeError | JXL_ENCODE_FAILED | invalid options or wasm OOM | | JxlInputTooLargeError | JXL_INPUT_TOO_LARGE | input > 256 MiB | | JxlDimensionsTooLargeError | JXL_DIMENSIONS_TOO_LARGE | image > 25 MP |

All extend WebcvtError from @catlabtech/webcvt-core.

Out of scope (v1)

  • Animated JPEG XL
  • HDR / wide-gamut round-trip beyond 8-bit RGBA
  • ICC profile preservation
  • Lossless JPEG→JXL transcoding (bit-exact recompression)
  • Streaming decode / worker-thread offload from this wrapper (the codec itself may still use its own worker for the multi-threaded path)

Source

packages/image-jsquash-jxl/src