pub fn encode_to_vec( data: impl AsRef<[u8]>, width: u32, height: u32, ) -> Result<Vec<u8>>
Encode the image into a newly allocated vector.