pub fn encode_to_buf( buf: impl AsMut<[u8]>, data: impl AsRef<[u8]>, width: u32, height: u32, ) -> Result<usize>
Encode the image into a pre-allocated buffer.
Returns the total number of bytes written.