Initialize the image library
#include <img.h> int img_lib_attach( img_lib_t* ilib );
This function initializes the image library, looks for a configuration file, and loads the codecs listed in that file.
If the function can't find a configuration file, it still fills in a valid library handle, but no codecs are loaded, and images can't be decoded. In this situation, the function returns IMG_ERR_CFG. You can load codecs after library initialization by calling img_cfg_read().
The image library uses a configuration file to determine which codecs to load, This function first checks the environment variable LIBIMG_CFGFILE, which is the full path for the configuration file. If it isn't set, then checks the default location /etc/system/config/img.conf.
Codecs in the configuration file are specified as sections. Each section of the configuration file is demarcated by the codec name in square brackets, followed by an unordered list of properties specifying additional information about that codec. There should be at least a mimetype line and list of extensions to associate with the codec. For example:
[img_codec_jpg.so] mime=image/jpeg:image/jpg ext=jpg:jpeg
|This example illustrates how to specify multiple entries in the same line, but has been simplified from the original. The default configuration file contains more mimetype entries.|