pub fn encode(
pixels: &[u8],
width: u32,
height: u32,
num_components: u8,
bit_depth: u8,
signed: bool,
options: &EncodeOptions,
) -> Result<Vec<u8>, &'static str>Expand description
Encode pixel data into a JPEG 2000 codestream.
§Arguments
pixels— Raw pixel data. For 8-bit: one byte per sample. For >8-bit: two bytes per sample (little-endian u16).width— Image width in pixels.height— Image height in pixels.num_components— Number of components (1 for grayscale, 3 for RGB).bit_depth— Bits per sample (e.g., 8, 12, 16).signed— Whether samples are signed.options— Encoding parameters.
§Returns
The encoded JPEG 2000 codestream bytes (.j2c format).