ImageGear Professional v18.1 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_detect_FD |
This function detects the format of the image file specified by a file descriptor.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_fltr_detect_FD( AT_INT fd, LONG lOffset, LPAT_MODE lpFileType ); |
Name | Type | Description |
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 into the file, in bytes, to where the image begins. This is the offset to the beginning of the header, not to the beginning of the bitmap. lOffset is usually 0. |
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 can not be detected, this parameter will return IG_FORMAT_UNKNOWN. |
This function does not process image pixels.
Copy Code
|
|
---|---|
AT_ERRCOUNT nErrCount; // will hold returned error count AT_MODE nFormatID; HANDLE fd; //File Descriptor fd = CreateFile(_T("picture.tif"), GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(fd != INVALID_HANDLE_VALUE) { nErrCount = IG_fltr_detect_FD((AT_INT)fd, 0, &nFormatID); if(nFormatID == IG_FORMAT_TIF) { // ... } CloseHandle(fd); } |
See also the section Detecting Image File Format.