The image module defines a range of error codes that are used in the miImg_file data structure, using the error field. There are also os_errors, which contain the unmodified Unix error. The following error codes are defined, in addition to 0 (no error). A sub-format error occurs if the file format is recognized, but the actual encoding is not supported. For example, there may be multiple compression methods allowed for a format, some of which are not supported by the image module.
| miIMG_ERR_READ | can't read, end of file |
| miIMG_ERR_WRITE | can't write, probably disk full |
| miIMG_ERR_DECODE | file format error |
| miIMG_ERR_ENCODE | internal error |
| miIMG_ERR_FORMAT | unrecognized file format |
| miIMG_ERR_SUBFORMAT | file version not supported |
| miIMG_ERR_CREATE | failed to create file |
| miIMG_ERR_OPEN | failed to open file |
| miIMG_ERR_CLOSE | failed to close file |
| miIMG_ERR_ARGS | incorrect call argument |
| miIMG_ERR_NOTOPEN | file not open |
| miIMG_ERR_NOTCLOSED | file still open, can't re-open |
| miIMG_ERR_SIZE | the .map file has an unexpected size |