Skip to main content

encode_image

Function encode_image 

pub fn encode_image(image: &DynamicImage) -> Result<Vec<u8>, ImageError>
Expand description

Encode image as a PNG in its own colour type (grey, RGB, with or without alpha, 8 or 16 bits).

Apps encode through this rather than DynamicImage::write_to: that is generic over the writer and dispatches over every format the image crate was built with, so each app calling it compiled every encoder into its own binary. This one is compiled once, in the shared runtime.