Skip to main content

jpeg_encode

Function jpeg_encode 

Source
pub fn jpeg_encode(
    pixels: &[u8],
    width: usize,
    height: usize,
    channels: usize,
    quality: u8,
) -> Result<Vec<u8>, ErrorsJSL>
Expand description

Encodes an 8-bit image as a baseline JPEG (JFIF) byte stream.

pixels holds width * height * channels interleaved samples, row-major, with channels equal to 1 (grayscale) or 3 (RGB). quality runs from 1 (smallest file) to 100 (best fidelity). Dimensions must be between 1 and 65535.