Image.GetThumbnailImage Method

Returns a thumbnail for this Image.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

Image^ GetThumbnailImage (
	int thumbWidth, 
	int thumbHeight, 
	GetThumbnailImageAbort^ callback, 
	IntPtr callbackData
public Image GetThumbnailImage (
	int thumbWidth, 
	int thumbHeight, 
	GetThumbnailImageAbort callback, 
	IntPtr callbackData
public function GetThumbnailImage (
	thumbWidth : int, 
	thumbHeight : int, 
	callback : GetThumbnailImageAbort, 
	callbackData : IntPtr
) : Image
Not applicable.



The width, in pixels, of the requested thumbnail image.


The height, in pixels, of the requested thumbnail image.


A Image.GetThumbnailImageAbort delegate. In GDI+ version 1.0, the delegate is not used. Even so, you must create a delegate and pass a reference to that delegate in this parameter.


Must be Zero.

Return Value

An Image that represents the thumbnail.

If the Image contains an embedded thumbnail image, this method retrieves the embedded thumbnail and scales it to the requested size. If the Image does not contain an embedded thumbnail image, this method creates a thumbnail image by scaling the main image.

The GetThumbnailImage method works well when the requested thumbnail image has a size of about 120 x 120 pixels. If you request a large thumbnail image (for example, 300 x 300) from an Image that has an embedded thumbnail, there could be a noticeable loss of quality in the thumbnail image. It might be better to scale the main image (instead of scaling the embedded thumbnail) by calling the DrawImage method.

The following code example creates and displays a thumbnail image. This delegate is never called.

public bool ThumbnailCallback()
 return false;
 public void Example_GetThumb(PaintEventArgs e)
 Image.GetThumbnailImageAbort myCallback =
 new Image.GetThumbnailImageAbort(ThumbnailCallback);
 Bitmap myBitmap = new Bitmap("Climber.jpg");
 Image myThumbnail = myBitmap.GetThumbnailImage(
 40, 40, myCallback, IntPtr.Zero);
 e.Graphics.DrawImage(myThumbnail, 150, 75);

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0