Skip to content
io
decode_jpeg

decode_jpeg

Mojo function 🡭

decode_jpeg

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

Decode a JPEG held in memory into a Canvas: read_jpeg after the file is read. Same scope and errors.

Args:

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

Returns:

Canvas: The decoded image as an opaque RGBA canvas.

Raises:

Error: Not a JPEG, an unsupported process, or malformed data.