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

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_ex(
   HIGEAR hOriginalImage,
   LPHIGEAR lphNewThumbnail,
   AT_DIMENSION nNewWidth,
   AT_DIMENSION nNewHeight,
   AT_MODE nInterpMethod,
   DWORD dwFlags,
   INT nValue
);

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.
dwFlags DWORD The contents of this parameter depends upon the value of nInterpMethod. This is currently not used.
nValue INT The contents of this parameter depends upon the value of nInterpMethod:
  • IG_INTERPOLATION_GRAYSCALE - nValue can be from 0 to 100. It takes the proportion of pixels from entry 1 to entry 0 (white/black).
  • IG_INTERPOLATION_PRESERVE_WHITE - nValue can be from 0 to 100. It indicates the threshold value of the amount of white color to include.
  • IG_INTERPOLATION_PRESERVE_BLACK - nValue can be from 0 to 100. It indicates the threshold value of the amount of black color to include.
  • Any other values - nValue is ignored.

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:

None

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.tif", 1 bpp, from working directory
nErrcount = IG_load_file("picture.tif", &hIGear);
if(nErrcount == 0)
{
    nErrcount = IG_IP_thumbnail_create_ex(hIGear, &hIGearThumb, 64, 64, IG_INTERPOLATION_GRAYSCALE, 0, 50);
    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_ex with the only difference that it returns a resized copy of the original image, instead of changing the original image. See IG_IP_resize_ex for additional details.

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