Function serenity::utils::read_image[][src]

pub fn read_image<P: AsRef<Path>>(path: P) -> Result<String>
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.