TIL: Base64 Encoding an ImageBuffer as PNG(in Rust)
Recently, I had to base64-encode an image::ImageBuffer to send it as a data URL like data:image/png;base64,iVBORw0KGgoAAAANSUhEU... Initially, I tried this: // Cargo.toml image = "0.24.7" base64 = "0.21.5" use base64::{engine::general_purpose, Engine as _}; use image::ImageBuffer; // WRONG:…