Skip to content
io
png
decode_png

decode_png

Mojo function 🡭

decode_png

fn def decode_png(var data: List[UInt8]) -> Canvas

Decode a PNG image held in memory into a Canvas: read_png after the file is read, for bytes that come from somewhere else, such as a font’s embedded bitmaps. Same scope and errors.

Args:

  • data (List[UInt8]): The complete PNG file contents.

Returns:

Canvas: The decoded image as an RGBA canvas.

Raises:

Error: Not a PNG, a corrupted chunk, or an unsupported feature (see the module docstring).