A high-performance general-purpose compute library

Save an array to memory as an image using FreeImage stream (FIMEMORY). More...

Functions

AFAPI void * saveImageMem (const array &in, const imageFormat format=AF_FIF_PNG)
 C++ Interface for saving an image to memory. More...
 
AFAPI af_err af_save_image_memory (void **ptr, const af_array in, const af_image_format format)
 C Interface for saving an image to memory using FreeImage. More...
 

Detailed Description

Save an array to memory as an image using FreeImage stream (FIMEMORY).

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

Function Documentation

◆ af_save_image_memory()

AFAPI af_err af_save_image_memory ( void **  ptr,
const af_array  in,
const af_image_format  format 
)

C Interface for saving an image to memory using FreeImage.

Parameters
[out]ptris the FIMEMORY pointer created by FreeImage.
[in]inis the arrayfire array to be saved as an image
[in]formatis the type of image to create in memory. The enum borrows from the FREE_IMAGE_FORMAT enum of FreeImage. Other values not included in af_image_format but included in FREE_IMAGE_FORMAT can also be passed to this function.
Returns
AF_SUCCESS if successful.

◆ saveImageMem()

AFAPI void * saveImageMem ( const array in,
const imageFormat  format = AF_FIF_PNG 
)

C++ Interface for saving an image to memory.

Parameters
[in]inis the arrayfire array to be saved as an image
[in]formatis the type of image to create in memory. The enum borrows from the FREE_IMAGE_FORMAT enum of FreeImage. Other values not included in imageFormat but included in FREE_IMAGE_FORMAT can also be passed to this function.
Returns
a void* pointer which is a type cast of the FreeImage type FIMEMORY* pointer.
Note
Ensure that deleteImageMem is called on this pointer. Otherwise there will be memory leaks