ArrayFire: saveImage (original) (raw)

Save an array to disk as an image. More...

Functions
AFAPI void saveimage (const char *filename, const array &in)
AFAPI void saveImage (const char *filename, const array &in)
C++ Interface for saving an image. More...
AFAPI void saveImageNative (const char *filename, const array &in)
C++ Interface for saving an image without modifications. More...
AFAPI af_err af_save_image (const char *filename, const af_array in)
C Interface for saving an image. More...
AFAPI af_err af_save_image_native (const char *filename, const af_array in)
C Interface for saving an image without modifications. More...

Save an array to disk as an image.

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

af_save_image()

C Interface for saving an image.

Parameters

[in] filename is name of file to be loaded
[in] in is the arrayfire array to be saved as an image

Returns

AF_SUCCESS if the color transformation is successful, otherwise an appropriate error code is returned.

af_save_image_native()

C Interface for saving an image without modifications.

This function only accepts u8, u16, f32 arrays. These arrays are saved to images without any modifications.

You must also note that note all image type support 16 or 32 bit images.

The best options for 16 bit images are PNG, PPM and TIFF. The best option for 32 bit images is TIFF. These allow lossless storage.

The images stored have the following properties:

Array Type Bits per Color (Gray/RGB/RGBA Bits Per Pixel) Range
u8 8 ( 8/24/32 BPP) 0 - 255
u16 16 (16/48/64 BPP) 0 - 65535
f32 32 (32/96/128 BPP) 0 - 1

Parameters

[in] filename is name of file to be saved
[in] in is the array to be saved. Should be u8 for saving 8-bit image, u16 for 16-bit image, and f32 for 32-bit image.

Returns

AF_SUCCESS if successful

AFAPI void saveimage ( const char * filename,
const array & in
)

C++ Interface for saving an image.

Parameters

[in] filename is name of file to be loaded
[in] in is the arrayfire array to be saved as an image

Deprecated:

Use saveImage instead

saveImage()

AFAPI void saveImage ( const char * filename,
const array & in
)

C++ Interface for saving an image.

Parameters

[in] filename is name of file to be loaded
[in] in is the arrayfire array to be saved as an image

Examples

pde/bhrt.cpp.

saveImageNative()

AFAPI void saveImageNative ( const char * filename,
const array & in
)

C++ Interface for saving an image without modifications.

This function only accepts u8, u16, f32 arrays. These arrays are saved to images without any modifications.

You must also note that note all image type support 16 or 32 bit images.

The best options for 16 bit images are PNG, PPM and TIFF. The best option for 32 bit images is TIFF. These allow lossless storage.

The images stored have the following properties:

Array Type Bits per Color (Gray/RGB/RGBA Bits Per Pixel) Range
u8 8 ( 8/24/32 BPP) 0 - 255
u16 16 (16/48/64 BPP) 0 - 65535
f32 32 (32/96/128 BPP) 0 - 1

Parameters

[in] filename is name of file to be saved
[in] in is the array to be saved. Should be u8 for saving 8-bit image, u16 for 16-bit image, and f32 for 32-bit image.