A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
loadImageMem
ArrayFire Functions | ArrayFire Functions by Category » Input and Output functions » Reading and writing images

## Functions
AFAPI array | loadImageMem (const void *ptr)
| C++ Interface for loading an image from memory.
AFAPI af_err | af_load_image_memory (af_array *out, const void *ptr)
| C Interface for loading an image from memory.

## Detailed Description

Load an image from memory which is stored as a FreeImage stream (FIMEMORY).

Supported formats include JPG, PNG, PPM and other formats supported by freeimage

## Function Documentation

## ◆ af_load_image_memory()

AFAPI af_err af_load_image_memory | ( | af_array * | out,
|  | const void * | ptr )

C Interface for loading an image from memory.

Parameters

  [out] | out | is an array that will contain the image
  [in] | ptr | is the FIMEMORY pointer created by either saveImageMem function, the af_save_image_memory function, or the FreeImage_OpenMemory API.

Returns
  AF_SUCCESS if successful

## ◆ loadImageMem()

AFAPI array loadImageMem | ( | const void * | ptr | ) |

C++ Interface for loading an image from memory.

Parameters

  [in] | ptr | is the location of the image data in memory. This is the pointer created by saveImage.

Returns
  image loaded as af::array()

Note
  The pointer used is a void* cast of the FreeImage type FIMEMORY which is created using the FreeImage_OpenMemory API. If the user is opening a FreeImage stream external to ArrayFire, that pointer can be passed to this function as well.