Skip to main content

read_header

Function read_header 

Source
pub fn read_header(data: &[u8]) -> Result<JxlImageInfo>
Expand description

Read image metadata without decoding pixels.

Parses the file header and ICC profile. Returns dimensions, bit depth, orientation, extra channel info, animation info, and color profile.

This is fast (~1μs for sRGB images, ~7μs for images with ICC profiles).

§Example

let data = std::fs::read("photo.jxl").unwrap();
let header = zenjxl_decoder::read_header(&data).unwrap();
let (w, h) = header.info.size;
println!("{w}x{h}");