INNER CODE UNIT · Rust
get_height
silvia-odwyer/photon · crate/src/lib.rs:189
pub fn get_height(&self) -> u32 {
self.height
}
/// Convert the PhotonImage to base64.
pub fn get_base64(&self) -> String {
let buffer = self.get_bytes();
let base64 = encode(&buffer);
let res_base64 = format!("data:image/png;base64,{}", base64.replace("\r\n", ""));
res_base64
}
/// Convert the PhotonImage to raw bytes. Returns PNG.
pub fn get_bytes(&self) -> Vec<u8> {
// Encode straight from raw_pixels; a DynamicImage round-trip would
// clone the frame twice.