ImageGear for C and C++ on Linux v20.0 - Updated
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_load_FD_format

This function loads an image from an open file into memory and creates a HIGEAR handle for the image.


Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_load_FD_format(
   AT_MODE nFormat,
   AT_INT fd,
   LONG lOffset,
   UINT nPage,
   UINT nTile,
   LPHIGEAR lphIGear


Name Type Description
nFormat AT_MODE A constant indicating the file format of the input file. See enumIGFormats for possible values. Set to IG_FORMAT_UNKNOWN to let ImageGear detect the file format.
fd AT_INT Handle of the open file containing the image. This handle can be obtained from Microsoft Windows functions such as CreateFile(), and cast to AT_INT for passing to the function parameter. FILE pointers returned by functions such as fopen(), and file handles returned by functions such as _sopen_s() are not supported.
lOffset LONG Offset to image in the file.
nPage UINT Page number to load if this is a multi-page file. Note that page numbers begin at 1, not 0. Set nPage to 1 if this is not a multi-page file.
nTile UINT Tile number to load, set to 1 for non-tiled image.
lphIGear LPHIGEAR ImageGear handle returned.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.


Copy Code
HIGEAR    hIGear;        // Will hold handle returned by IG_fltr_load_file
AT_ERRCOUNT nErrCount;    // Count of errs on stack upon ret from func*/
HANDLE      fd;            //File Descriptor
fd = CreateFile(_T("picture.tif"), GENERIC_READ,
    // Load the selected image
    nErrCount = IG_fltr_load_FD_format(IG_FORMAT_TIF, (AT_INT)fd, 0, 1, 0, &hIGear);
    if(nErrCount == 0)
        // ...

        // Delete the image


If nFormat = IG_FORMAT_UNKNOWN then ImageGear attempts to detect the file format automatically, and then loads the image. Otherwise, ImageGear skips the file format detection and loads the file with the specified format filter.

See also the section Loading and Saving.

Is this page helpful?
Yes No
Thanks for your feedback.