pub fn encode(image: &ImageBuffer) -> Result<Vec<u8>, String>