A pretty fast JPEG decoder
Features
- SSE and AVX accelerated functions to speed up certain decoding operations
- Really fast and accurate 32 bit IDCT algorithm
- Fast color convert functions
- RGBA and RGBX (4-Channel) color conversion functions
- YCbCr to GrayScale conversion.
Examples
Decode a JPEG file with default arguments.
use zune_jpeg::Decoder;
//will contain pixels
let mut pixels = Decoder::new().decode_file("a_jpeg_file").unwrap();
Decode a JPEG file to RGBA format
use zune_jpeg::Decoder;
let mut decoder = Decoder::new();
decoder.rgba(); // or equivalently decoder.set_output_colorspace(ColorSpace::RGBA)
decoder.decode_file("a_jpeg_file");
Decode an image and get it's width and height.
use zune_jpeg::Decoder;
let mut decoder = Decoder::new();
decoder.set_output_colorspace(zune_jpeg::ColorSpace::GRAYSCALE);
decoder.decode_file("a_jpeg_file");
let image_info = decoder.info().unwrap();
println!("{},{}",image_info.width,image_info.height)