mlx.data.Buffer.load_image

mlx.data.Buffer.load_image#

Buffer.load_image(self: mlx.data._c.Buffer, key: str, prefix: str = '', info: bool = False, format: str = 'RGB', from_memory: bool = False, output_key: str = '') mlx.data._c.Buffer#

Load an image file.

Loads an image from an image file on disk or in memory. It can also load the image info instead.

Note

The format is ignored for now.

Parameters:
  • key (str) – The sample key that contains the array we are operating on.

  • prefix (str) – The filepath prefix to use when loading the files. (default: ‘’)

  • info (bool) – If True load the image width and height instead of the image data. (default: False)

  • format (str) – Currently ignored but in the future it should decide whether to load the alpha channel or map the channels to some other space (e.g. YCbCr) (default: RGB).

  • from_memory (bool) – If true assume the file contents are in the array instead of the file name. (default: False)

  • output_key (str) – The key to store the result in. If it is an empty string then overwrite the input. (default: ‘’)