pub fn encode(
image: &DynamicImage,
format: Option<ImageFormat>,
) -> Result<Vec<u8>, ConvertError>Expand description
Scales an image into the limits of the API, and encodes it.
A JPEG stays a JPEG. Each other format becomes a PNG, so that text stays sharp.
ยงErrors
Returns ConvertError::Size if no scale fits the image, and ConvertError::Decode if the
encoder fails.