Skip to main content

encode_slice

Function encode_slice 

Source
pub fn encode_slice<T: Sample>(
    width: u32,
    height: u32,
    data: &[T],
    precision: Precision<T>,
) -> Result<Vec<u8>>
Expand description

Encode a single-band image with all pixels valid.

The pixel type T determines the LERC data type automatically via Sample. Returns an error if data.len() != width * height.

This helper internally clones data into an owned Image. For zero-copy encoding, including multi-band layouts, see encode_borrowed.