Skip to main content

auto_format

Function auto_format 

Source
pub fn auto_format(image: &DynamicImage, source_mime: &str) -> EncodeFormat
Expand description

The output format for format-auto or no format at all.

Lossless PNG and WebP keep photos at megabytes, so an image with no transparent pixel becomes a JPEG; one with transparency keeps it (WebP stays WebP, everything else becomes PNG). An alpha channel whose pixels are all opaque counts as opaque — many photos are saved as RGBA without using it.