Skip to main content

decode

Function decode 

Source
pub fn decode(codestream: &[u8]) -> Result<Image>
Expand description

Decode a JPEG 2000 codestream (Annex A, no JP2 wrapper) into an Image: the reference-grid image area plus one Component per SIZ component, each on its own sample grid.

This is the whole public surface for the GRIB2 use case: the ยง7 data section of a grid_jpeg message is exactly such a codestream. That subset is single-component, so its images carry one component; a codestream declaring more decodes each component onto its own grid, independently.

Pass the bare codestream, not a .jp2 file: a JP2 wrapper is valid JPEG 2000 but is rejected with Error::Unsupported rather than unwrapped. Anything else outside the decoded subset is rejected the same way, never half-decoded.