SOD C/C++ API Reference - Image Processing


int sod_img_set_load_from_directory(const char *zPath, sod_img ** apLoaded, int * pnLoaded, int max_entries);


Load all existing images from a given directory. On success, an array holding all loaded images is returned in an instance of the sod_img object where each entry of this array can be processed or analyzed via the exported interfaces. As of this release, the following image format are officially supported: JPEG, PNG, BMP, HDR, PSD, TGA, PIC, PPM, PGM, PBM. Once done, you must release this array via sod_img_set_release() to avoid memory leaks. If you want to load an image from memory, call sod_img_load_from_mem() instead. You can also load a single image from disk via sod_img_load_from_file().


const char    *zPath

Source path of the target directory where the images are located.

sod_img    **apLoaded

OUT: Each loaded image from this directory is stored in an instance of this sod_img array.

int    *pnLoaded

OUT: Total number of entries in the apLoaded sod_img array.

int    max_entries

Maximum entries to load from this directory. Set this parameter to 0 for the default behavior (i.e. load all supported images).

Return Value

SOD_OK is returned on success. Any other return value indicates failure. Once done, you must release the memory allocated to the apLoaded array via sod_img_set_release() to avoid memory leaks.


Checkout the introduction course, the C/C++ samples on the download page or refer to the SOD Github Repository.

See also