ImageGear for C and C++ on Linux v18.8 - Updated
IG_load_thumbnail_FD
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Load Functions > IG_load_thumbnail_FD

This function loads a thumbnail from the file specified by a file handle.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_load_thumbnail_FD(
   AT_INT fd,
   LONG lOffset,
   LPHIGEAR lphIGear
);

Arguments:

Name Type Description
fd AT_INT Handle of the open file containing the image from which to load the thumbnail. 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 in file at which file image begins.
lphIGear LPHIGEAR Pointer to a HIGEAR variable to receive the handle.

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

Example:

 
Copy Code
HIGEAR hIGear1 = 0;     /* handle ret'd by IG_load_FD  */
HIGEAR hIGear2 = 0;     /* handle for thumbnail  */
HANDLE fd;                /* DOS File Descriptor  */
LONG     lOffset;           /* offset to image in file */
UINT     nPageNum;          /* will be 0 for this call */
AT_ERRCOUNT nErrcount;        /* to test for errors  */

fd = CreateFile(_T("picture.bmp"), GENERIC_READ,
        0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

if(fd != INVALID_HANDLE_VALUE)
{
    nPageNum  = 0;          /* not a multi-page file  */
    lOffset    = 0;         /* access file from start */
    /* Load image, and obtain its HIGEAR handle:    */
    nErrcount = IG_load_FD((AT_INT)fd, lOffset, nPageNum, 0, &hIGear1 );
    CloseHandle(fd);
    if(nErrcount == 0)
    { 
        nErrcount = IG_load_thumbnail_FD((AT_INT)fd, lOffset, &hIGear2 ); 
    }

    //...

    // Destroy images
    if(IG_image_is_valid(hIGear1))
    {
        IG_image_delete(hIGear1);
    }
    if(IG_image_is_valid(hIGear2))
    {
        IG_image_delete(hIGear2);
    }
}

Remarks:

The handle of the resulting image is returned to the HIGEAR variable pointed to by argument lphIGear. See also functions IG_load_thumbnail, and IG_save_thumbnail_set.