Skip to main content

decode_bytes_within

Function decode_bytes_within 

Source
pub fn decode_bytes_within(
    data: &[u8],
    max_side: u32,
) -> Result<RgbaImage, String>
Expand description

Decodes the picture in data no larger than max_side pixels on its longer side, as straight-alpha sRGB RGBA, not turned. ImageIO scales while it decodes (a JPEG at a fraction of its size directly), so a huge picture never sits in memory at full size. Any format ImageIO reads.