Skip to main content

decode_jpeg

Function decode_jpeg 

Source
pub fn decode_jpeg(bytes: &[u8]) -> Result<(Vec<u8>, u32, u32), CvError>
Expand description

Decode a JPEG byte stream into packed RGB8 plus dimensions.

Returns (rgb, width, height) where rgb.len() == width * height * 3. Baseline colour JPEGs decode directly to RGB24. Grayscale (L8) is replicated across R/G/B. 16-bit luma (L16) and CMYK (CMYK32) are not supported here and map to CvError::InvalidParameter (fail closed) — the crate has no UnsupportedFormat variant.

Cold path only. Any decode failure maps to a CvError — never panics.