Skip to main content

Module jpeg

Module jpeg 

Expand description

JPEG encoding of 8-bit frames and decoded images.

Apps keep photographs, camera frames and re-encoded pastes as JPEG. They encode through these functions rather than the image crate’s generic encoders, so the encoder is compiled once, in the shared runtime, and not again into each app’s binary.

Functions§

encode_image
Encode image as a JPEG of quality: grey images stay grey, every other colour type becomes 8-bit RGB (alpha dropped, deeper channels narrowed), as the encoder requires.
encode_rgb8
Encode rgb (width * height * 3 bytes, row-major) as a JPEG of quality (1-100).
encode_rgba8_opaque
Encode rgba (width * height * 4 bytes) as a JPEG of quality, dropping its alpha channel: JPEG keeps none. Each pixel keeps its colour values as they are, uncomposited.