ImageGear for C and C++ on Windows v20.5 - Updated
IG_IP_thumbnail_create
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_thumbnail_create

This function creates a resized copy of the image. It can be used for creating a thumbnail (small preview version of the image).

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_thumbnail_create(
   HIGEAR hOriginalImage,
   LPHIGEAR lphNewThumbnail,
   AT_DIMENSION nNewWidth,
   AT_DIMENSION nNewHeight,
   AT_MODE nInterpMethod
);

Arguments:

Name Type Description
hOriginalImage HIGEAR HIGEAR handle of image of which to create thumbnail image.
lphNewThumbnail LPHIGEAR Pointer to a variable of type HIGEAR to receive the HIGEAR handle of the created thumbnail image.
nNewWidth AT_DIMENSION Specifies width wanted for the new image.
nNewHeight AT_DIMENSION Specifies height wanted for the new image.
nInterpMethod AT_MODE Specifies interpolation method to use for image resizing. See enumIGInterpolations for possible values.

Return Value:

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

Supported Raster Image Formats:

If nInterpMethod is IG_INTERPOLATION_GRAYSCALE, IG_INTERPOLATION_PRESERVE_WHITE, or IG_INTERPOLATION_PRESERVE_BLACK:

If nInterpMethod is IG_INTERPOLATION_AVERAGE or IG_INTERPOLATION_BILINEAR:

All pixel formats supported by ImageGear for C and C++, except:

If nInterpMethod is IG_INTERPOLATION_BICUBIC:

All pixel formats supported by ImageGear for C and C++, except:

Otherwise, all pixel formats supported by ImageGear for C and C++.

Sample:

Image Processing, GUI

Example:

 
Copy Code
HIGEAR hIGear;            // HIGEAR handle of the image
HIGEAR hIGearThumb;        // HIGEAR handle of the thumbnail image
AT_ERRCOUNT nErrcount;    // Count of errs on stack upon ret from func

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    nErrcount = IG_IP_thumbnail_create(hIGear, &hIGearThumb, 64, 64, IG_INTERPOLATION_BILINEAR);
    if(nErrcount == 0)
    {
        // ...
        // Destroy the thumbnail image
        IG_image_delete(hIGearThumb);
    }
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

This function works in the same way as IG_IP_resize except that it returns a resized copy of the original image, instead of changing the original image. See IG_IP_resize for additional details.

The functionality of this API call has been upgraded and supported by the new function IG_IP_thumbnail_create_ex. This new function allows you to pass additional parameters that affect interpolation.

Is this page helpful?
Yes No
Thanks for your feedback.