Skip to main content

encode

Function encode 

Source
pub fn encode(
    image: &DynamicImage,
    encoding: &EncodingOps,
    source_mime: &str,
) -> Result<(Vec<u8>, String, String), String>
Expand description

Encode image per the supplied EncodingOps, applying background-color flattening when targeting a non-alpha format (JPEG). Returns (bytes, mime, extension). When encoding.format is None, falls back to source_mime (JPEG passthrough, anything else → PNG) to preserve the v0.2 behavior.

§Errors

Encoder failures from the image crate.