Decode a frame from a file on the filesystem
#include <img/img.h> int img_load_file( img_lib_t ilib, const char* path, const img_decode_callouts_t* callouts, img_t* img );
- A handle for the image library, returned by img_lib_attach().
- The full path to the file from which the data can be read.
- A pointer to an img_decode_callouts_t structure that provides system callouts for the decoder. If you specify NULL for this value, a set of default callouts is supplied.
- The address of an img_t structure the function fills in with information about the decoded frame.
You can override elements, such as the format, before the call to img_load_file():
img.format = IMG_FMT_G8; img.flags |= IMG_FORMAT; img_load_file(...);
In the above example, because the format is set before the load occurs, the libimg will force the loaded image into IMG_FMT_G8 format, regardless of the actual source image format.
Use the -l img option to qcc to link against this library.
This function decodes a frame from a file on the filesystem. This function decodes only the first frame encountered.
If you want to resize a file when it's loaded, use img_load_resize_file().
- Invalid data encountered in the file, preventing the decode from proceeding. Some of the frame may be intact.
- An error occurred processing the DLL that handles the file type. Check to make sure that the DLL is not missing or corrupt.
- Error accessing path (errno is set).
- No appopriate codec could be found. The codec you require could be missing or corrupt, or the file could be corrupt.
- Decode was interrupted by application.
- Memory-allocation failure.
- No frame data was present. This error is highly unlikely, as files generally contain at least one frame.
- Output data not supported; the codec and application could not agree on an output format.
- Premature end of file encountered. Some of the frame may be intact.