Skip to main content

decompress_jpeg

Function decompress_jpeg 

Source
pub fn decompress_jpeg(src: &NDArray) -> Option<NDArray>
Expand description

Decompress a JPEG-compressed NDArray.

Uses jpeg-decoder to decode the JPEG data back to pixel data. Reconstructs proper dimensions and color layout (mono or RGB1).

A decoded JPEG is always 8-bit mono or 8-bit RGB1 (C comment at NDPluginCodec.cpp:268-272), whatever the layout of the array that was compressed, so C overwrites the ColorMode attribute on the output (:318-322). Without that write an RGB2/RGB3 source’s stale ColorMode would survive onto RGB1 data and every downstream getInfo would read the planes in the wrong order.

Returns None if the codec is not JPEG or decoding fails.