Function serenity::utils::read_image [−][src]
Expand description
Reads an image from a path and encodes it into base64.
This can be used for methods like EditProfile::avatar
.
Examples
Reads an image located at ./cat.png
into a base64-encoded string:
use serenity::utils;
let image = utils::read_image("./cat.png").expect("Failed to read image");
Errors
Returns an Error::Io
if the path does not exist.