Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Image.GetThumbnailImage method

Applies to: desktop apps only

The Image::GetThumbnailImage method gets a thumbnail image from this Image object.

Syntax

Image* GetThumbnailImage(
  [in]  UINT thumbWidth,
  [in]  UINT thumbHeight,
  [in]  GetThumbnailImageAbort callback,
  VOID *callbackData
);

Parameters

thumbWidth [in]

Type: UINT

Width, in pixels, of the requested thumbnail image.

thumbHeight [in]

Type: UINT

Height, in pixels, of the requested thumbnail image.

callback [in]

Type: GetThumbnailImageAbort

Optional. Callback function that you provide. During the process of creating or retrieving the thumbnail image, GDI+ calls this function to give you the opportunity to abort the process. The default value is NULL.

callbackData

Type: VOID*

Optional. Pointer to a block of memory that contains data to be used by the callback function. The default value is NULL.

Return value

Type:

Type: Image*

This method returns a pointer to an Image object that contains the thumbnail image.

Remarks

A thumbnail image is a small copy of an image. Some image files have a thumbnail image embedded in the file. In such cases, this method retrieves the embedded thumbnail image. If there is no embedded thumbnail image, this method creates a thumbnail image by scaling the main image to the size specified in the thumbWidth and thumbHeight parameters. If both of those parameters are 0, a system-defined size is used.

Examples

The following example creates an Image object based on a JPEG file. The code calls the Image::GetThumbnailImage method of that Image object and then displays the thumbnail image along with the main image.


VOID Example_GetThumbnail(HDC hdc)
{
   Graphics graphics(hdc);

   // Create an image and a thumbnail of the image.
   Image image(L"Crayons.jpg");
   Image* pThumbnail = image.GetThumbnailImage(40, 40, NULL, NULL);

   // Draw the original and the thumbnail images.
   graphics.DrawImage(&image, 10, 10, image.GetWidth(), image.GetHeight());
   graphics.DrawImage(
      pThumbnail, 
      150, 
      10, 
      pThumbnail->GetWidth(), 
      pThumbnail->GetHeight());

   delete pThumbnail;

}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusheaders.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Image
Bitmap
Creating Thumbnail Images
Images, Bitmaps, and Metafiles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

Show:
© 2014 Microsoft