decode

Function decode 

Source
pub fn decode(bytes: &[u8]) -> Result<(PngHeader, Vec<[u8; 4]>), DecodeError>
Expand description

Decodes the provided PNG into RGBA pixels.

The returned PngHeader contains the image’s size, and other PNG metadata which is not necessary to make use of the pixels (the returned format is always 8-bit-per-component RGBA).

The returned Vec contains the pixels, represented as [r, g, b, a] arrays. Its length will be equal to header.width * header.height. (If you need a Vec<u8> of length header.width * header.height * 4 instead, you can use Vec::into_flattened() to convert it.)