Skip to main content

decode_standard_image

Function decode_standard_image 

Source
pub fn decode_standard_image(
    data: &[u8],
    format: StandardFormat,
) -> RawResult<RgbImage>
Expand description

Decode a standard (non-RAW) image to an RgbImage using each format’s default decoder implementation.

The caller must supply the StandardFormat explicitly. Use detect_standard_format to infer it from magic bytes when the format is not otherwise known. To pin a specific decoder implementation or pass implementation-specific configuration, use decode_standard_image_with.

The returned RgbImage contains 16-bit interleaved RGB data in row-major order. 8-bit source images are scaled to 16-bit by multiplying by 257.

§Errors

Returns [RawError::ImageDecodeError] on decode failure, or [RawError::UnsupportedFormat] for formats without a decoder.