DevIL Documentation Home | Previous | Next


The ilLoadImage function loads an image from a file.

ILboolean ilLoadImage(
  char *FileName


Specifies which file to load an image from.


The ilLoadImage function allows a general interface to the specific internal file-loading routines. The approach ilLoadImage takes toward determining image types is three-pronged. First, it finds the extension and checks to see if any user-registered functions (registered through ilRegisterLoad) match the extension. If nothing matches, it takes the extension and determines which function to call based on it. Lastly, it attempts to identify the image based on various image header verification functions, such as ilIsValidPngF. If all this checking fails, IL_FALSE is returned with no modification to the current bound image.

Error Codes

IL_COULD_NOT_OPEN_FILE - The file pointed to by FileName could not be opened. Either the file does not exist or is in use by another process.
IL_ILLEGAL_OPERATION - There is currently no image bound. Use ilGenImages and ilBindImage before calling this function.
IL_INVALID_EXTENSION - The file could not be loaded based on extension or header.
IL_INVALID_PARAM - FileName was not valid. It was most likely NULL.

See Also

ilGenImages, ilBindImage, ilLoad, ilLoadF, ilLoadL, ilLoadPal