Skip to main content

decode

Function decode 

Source
pub fn decode(
    path: &Path,
    target: (u32, u32),
    format: PixelFormat,
) -> Result<DecodedImage, MediaError>
Expand description

Decode path and scale it to fit target (width, height in px), preserving aspect ratio and never scaling up.

Never upscales: a 32×32 icon blown up to fill a block is worse than the same icon shown small, and the caller cannot tell the difference from the returned dimensions alone.