Open HarrisDePerceptron opened 1 year ago
@HarrisDePerceptron
/// Convert the PhotonImage to raw bytes. Returns JPEG.
pub fn get_bytes(&self) -> Vec<u8> {
let mut img = helpers::dyn_image_from_raw(self);
img = ImageRgba8(img.to_rgba8());
let mut buffer = vec![];
img.write_to(&mut buffer, image::ImageOutputFormat::Png)
.unwrap();
buffer
}
As the doc comment says, get_bytes
is meant to be an encoded image, which is different. Although it seems it returns a PNG, not JPEG.
why are these not equal
@igrep @rsk700 @Horki @Clivern @samuelvanderwaal