Skip to main content

Module api

Module api 

Source
Expand description

Three-layer public API: Config → Request → Encoder.

use jxl_encoder::{LosslessConfig, LossyConfig, PixelLayout};

// Simple — one line, no request visible
let jxl = LossyConfig::new(1.0)
    .encode(&pixels, 800, 600, PixelLayout::Rgb8)?;

// Full control — request layer for metadata, limits, cancellation
let jxl = LosslessConfig::new()
    .encode_request(800, 600, PixelLayout::Rgb8)
    .encode(&pixels)?;

Re-exports§

pub use crate::entropy_coding::Lz77Method;

Macros§

at
Start tracing an error with crate metadata for repository links.

Structs§

AnimationFrame
A single frame in an animation sequence.
AnimationParams
Animation timing parameters.
At
An error with location tracking - wraps any error type.
EncodeRequest
An encoding request — binds config + image dimensions + pixel layout.
EncodeResult
Result of an encode operation. Holds encoded data and metrics.
EncodeStats
Encode metrics collected during encoding.
ImageMetadata
Image metadata (ICC, EXIF, XMP, tone mapping) to embed in the JXL file.
Limits
Resource limits for encoding.
LosslessConfig
Lossless (modular) encoding configuration.
LosslessEncoder
Streaming lossless (modular) encoder.
LossyConfig
Lossy (VarDCT) encoding configuration.
LossyEncoder
Streaming lossy (VarDCT) encoder.
Unstoppable
A Stop implementation that never stops (no cooperative cancellation).

Enums§

EncodeError
Encode error type.
EncodeMode
Encoding mode.
EncoderMode
Controls whether the encoder matches libjxl’s algorithm choices or uses its own improvements.
PixelLayout
Describes the pixel format of input data.
ProgressiveMode
Progressive encoding mode for VarDCT.
Quality
Quality specification for lossy encoding.

Traits§

ResultAtExt
Extension trait for adding location tracking to Result<T, At<E>>.
Stop
Cooperative cancellation check.

Functions§

at
Wrap any value in At<E> and capture the caller’s location.
calibrated_jxl_quality
Map generic quality (libjpeg-turbo scale) to JXL native quality.
quality_to_distance
Convert quality on 0–100 scale to JXL butteraugli distance.

Type Aliases§

Result
Result type for encoding operations.