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

This function detects the format of the image file specified by a filename.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_detect_file_W(
   const LPAT_WCHAR lpwszFileName,
   LPAT_MODE lpFileType
);

Arguments:

Name Type Description
lpwszFileName const LPAT_WCHAR File name of the image whose format you wish to detect, specified as a wide string (UTF-16).
lpFileType LPAT_MODE Pointer to an AT_MODE variable in which the file type will be returned. See enumIGFormats for possible values. If the file format cannot be detected, this parameter will return IG_FORMAT_UNKNOWN.

Return Value:

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

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

GUI Windows

Example:

 
Copy Code
AT_ERRCOUNT nErrCount; // will hold returned error count
AT_MODE nFormatID;

nErrCount = IG_fltr_detect_file_W(L"picture.tif", &nFormatID);
if(nFormatID == IG_FORMAT_TIF)
{
    // ...
}

Remarks:

See also the section Detecting Image File Format.