Interface JXLEncodeOptions

Options of Image.encodeJXL

interface JXLEncodeOptions {
    effort?: number;
    metadata?: Metadata;
    quality?: number;
    threads?: number;
}

Properties

effort?: number

How hard lossy compression searches for the best transforms: 0-2, faster to smaller. 0 uses 8x8 DCTs only (like cjxl -e 3), 1 and 2 search their sizes like cjxl -e 5 (2 tries more of the small ones), and 2 also stores text-like features that repeat (the glyphs of screenshots) once, as patches like cjxl -e 7. Default: 1

metadata?: Metadata

Metadata to include, see Metadata

quality?: number

Lossy compression (0-100, like cjxl's -q: 90 is visually lossless, 100 lossless): higher is better and larger. Without it the image is encoded losslessly

threads?: number

At most this many worker threads compress lossily in parallel (the same file, faster: 2.6 times with 8 on a 1920x1080 photo at effort 1, 4.2 times on 3840x2160), 1 for none. Small images (under about 1.5 megapixels at effort 0, 512x512 pixels at 1, 384x384 at 2), and runtimes whose workers can't share memory (browsers without cross-origin isolation) encode without them. Default: the processors available, at most 8