Function turbojpeg::decompress_image

source ·
pub fn decompress_image<P>(jpeg_data: &[u8]) -> Result<ImageBuffer<P, Vec<u8>>>
where P: JpegPixel + 'static,
Expand description

Decompresses image from JPEG into an image::ImageBuffer.

§Example

// read JPEG data from file
let jpeg_data = std::fs::read("examples/parrots.jpg")?;

// decompress `jpeg_data` into an `image::RgbImage`
let image: image::RgbImage = turbojpeg::decompress_image(&jpeg_data)?;