API referencestd/image

std/image/jxl

Public declarations, types, methods, and source contracts for std/image/jxl.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/image/jxl"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
color std/image/color colorinfo.dodo, decode.dodo
convert std/image/convert bitreader.dodo, extra.dodo, features.dodo, output.dodo, render.dodo, vardct.dodo, vardct_tables.dodo
isobmff std/image/shared/isobmff bitreader.dodo, container.dodo
math std/math features.dodo, vardct_tables.dodo, xyb.dodo
meta std/image/meta container.dodo, decode.dodo
num core/num bitreader.dodo, decode.dodo, framedec.dodo
pixels std/image/pixels container.dodo, decode.dodo, entropy.dodo, extra.dodo, features.dodo, frame.dodo, framedec.dodo, headers.dodo, icc.dodo, modular.dodo, output.dodo, render.dodo, scan.dodo, skim.dodo, transforms.dodo, vardct.dodo, vardct_tables.dodo, window.dodo
ptr core/ptr render.dodo, vardct.dodo
scratch std/image/shared/scratch decode.dodo, extra.dodo, icc.dodo
sink std/image/sink decode.dodo, extra.dodo, output.dodo, render.dodo
slice core/slice decode.dodo, extra.dodo, icc.dodo
trig std/math/trig vardct_tables.dodo

Reader

Struct · Source

pub struct Reader {
    // A read went past the data or the limit.
    pub overrun: bool
    // The container structure is invalid.
    pub broken: bool
    // Private implementation fields omitted.
}

matches

Function · Source

Signature check only: a bare codestream or the container signature box.

pub fn matches(data: &[u8]) -> bool

info

Function · Source

Image size, native layout, bit depth, color description, orientation and frame count (displayed frames of an animation). Walks every frame header.

pub fn info(data: &[u8]) -> pixels.Header!pixels.Error

metadata

Function · Source

EXIF and XMP boxes of a container file, and the ICC profile (entropy coded in the codestream: decode it with icc()).

pub fn metadata(data: &[u8]) -> meta.Metadata!pixels.Error

frame_info

Function · Source

Display time of displayed frame index: duration ticks over the animation’s ticks per second. Still images report 0/1.

pub fn frame_info(data: &[u8], index: u32) -> pixels.FrameInfo!pixels.Error

scratch_size

Function · Source

Bytes of scratch decode() and decode_frame() need for this file (also enough for icc()).

pub fn scratch_size(data: &[u8]) -> usize!pixels.Error

decode

Function · Source

Decode the first displayed frame into output, which receives the header (as info() reports it) and then tile rects in the native layout. scratch needs scratch_size(data) bytes.

pub fn decode<S: sink.Sink>(data: &[u8], output: &mut S, buffer: &mut[u8]) -> void!pixels.Error

decode_frame

Function · Source

Decode displayed frame index (0-based, counting the frames an animation shows), composited over earlier frames as the format specifies.

pub fn decode_frame<S: sink.Sink>(data: &[u8], index: u32, output: &mut S, buffer: &mut[u8]) -> void!pixels.Error

icc

Function · Source

The decoded ICC profile into output; returns its length. Fails Malformed for files without one. scratch needs scratch_size(data) bytes.

pub fn icc(data: &[u8], output: &mut[u8], buffer: &mut[u8]) -> usize!pixels.Error

ExtraChannelType

Enum · Source

Extra channel types.

pub enum ExtraChannelType {
    Alpha
    Depth
    SpotColor
    SelectionMask
    Black
    Cfa
    Thermal
    // Type 16: may be ignored. (Type 15, an extra channel that must not be
    // ignored but is unknown, fails Unsupported as in libjxl.)
    Optional
}

ExtraChannelInfo

Struct · Source

One extra channel as described by the image header.

pub struct ExtraChannelInfo {
    pub kind: ExtraChannelType
    // Bits per sample; exponent_bits > 0 for floating-point samples.
    pub bit_depth: u32
    pub exponent_bits: u32
    // The channel is coded at 1 / 2^dim_shift of the image size (and
    // decoded to full size).
    pub dim_shift: u32
    // Alpha channels: color is premultiplied by this channel.
    pub alpha_associated: bool
    // Spot colors: linear RGB of the ink and its solidity.
    pub spot_color: [4]f32
    // CFA channels: the channel index of the color filter array.
    pub cfa_channel: u32
    // Byte length of the channel name (UTF-8, see extra_channel_name()).
    pub name_length: u32
    // The layout decode_extra_channel() emits: gray, U8 for integer depths
    // up to 8, U16 up to 16, F32 for float or deeper samples.
    pub layout: pixels.Layout
}

extra_channel_count

Function · Source

Number of extra channels (alpha included).

pub fn extra_channel_count(data: &[u8]) -> u32!pixels.Error

extra_channel_info

Function · Source

Description of extra channel channel (0-based, < extra_channel_count).

pub fn extra_channel_info(data: &[u8], channel: u32) -> ExtraChannelInfo!pixels.Error

extra_channel_name

Function · Source

The UTF-8 name of extra channel channel into output; returns its byte length (BufferTooSmall when output is shorter).

pub fn extra_channel_name(data: &[u8], channel: u32, output: &mut[u8]) -> usize!pixels.Error

decode_extra_channel

Function · Source

Decode extra channel channel of displayed frame index into output: a header (info()’s, with the channel’s gray layout and depth) then tile rects of the full-size channel (upsampled from its dim_shift as libjxl does), composited across animation frames like the color channels. buffer needs scratch_size(data) bytes.

pub fn decode_extra_channel<S: sink.Sink>(data: &[u8], index: u32, channel: u32, output: &mut S, buffer: &mut[u8]) -> void!pixels.Error

Search every guide, reference page, and API declaration.