ImageGear for C and C++ on Windows v19.6 - Updated
IG_fltr_load_file_format_W
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_load_file_format_W

This function loads an image from the specified file into memory and creates a HIGEAR handle for this image. The function allows skipping automatic detection of the file format and instead using the specified format ID.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_load_file_format_W(
   AT_MODE nFormat,
   const LPAT_WCHAR lpwszFileName,
   UINT nPage,
   LPHIGEAR lphIGear
);

Arguments:

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.
lpwszFileName const LPAT_WCHAR Path and name of the file, specified as a wide string (UTF-16) to load. The path can be absolute or relative.
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.
lphIGear LPHIGEAR Pointer to the HIGEAR object in which to return the ImageGear handle of the image.

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++.

Sample:

None

Example:

 
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*/
// Load the selected image
nErrCount = IG_fltr_load_file_format_W(IG_FORMAT_TIF, L"picture.tif", 1, &hIGear);
if(nErrCount == 0)
{
    // ...

    // Delete the image
    IG_image_delete(hIGear);
}

Remarks:

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 "Getting Information about a Format Filter" in Loading and Saving.

This function may work slower on PDF and PostScript images, compared to its ANSI analog IG_fltr_load_file_format.