ImageGear Professional DLL v17.1 for Windows Accusoft
IG_fltr_detect_FD
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_detect_FD

Glossary Item Box

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

Declaration:

  Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_detect_FD(
   AT_INT fd,
   LONG lOffset,
   LPAT_MODE lpFileType
);

Arguments:

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

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:

None

Example:

  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);
}

Remarks:

See also the section Detecting Image File Format.

©2012. Accusoft Corporation. All Rights Reserved.