View Source ImageRs (image_rs v0.2.1)

Documentation for ImageRs.

Summary

Functions

Decode image from a given file

Decode image from buffer in memory

Functions

Decode image from a given file

  • filename. Path to the image.

Example

{:ok, img, shape, type} = ImageRs.from_file("/path/to/image")
{h, w, c} = shape

Decode image from buffer in memory

  • buffer. Buffered raw file data in memory.

Example

# image buffer from a file or perhaps download from Internet
{:ok, buffer} = File.read("/path/to/image")
# decode the image from memory
{:ok, img, shape, type} = ImageRs.from_memory(buffer)
{h, w, c} = shape