Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
CreateThumbnail Method
See Also  Example
Leadtools Namespace > RasterImage Class : CreateThumbnail Method



thumbnailWidth
The desired maximum width of the thumbnail image in pixels.
thumbnailHeight
The desired maximum height of the thumbnail image in pixels.
bitsPerPixel
The desired bits per pixel.
viewPerspective
The desired view perspective.
sizeFlags
Flags that control the resize operation.
Creates a thumbnail image of this RasterImage.

Syntax

Visual Basic (Declaration) 
Public Function CreateThumbnail( _
   ByVal thumbnailWidth As Integer, _
   ByVal thumbnailHeight As Integer, _
   ByVal bitsPerPixel As Integer, _
   ByVal viewPerspective As RasterViewPerspective, _
   ByVal sizeFlags As RasterSizeFlags _
) As RasterImage
Visual Basic (Usage)Copy Code
Dim instance As RasterImage
Dim thumbnailWidth As Integer
Dim thumbnailHeight As Integer
Dim bitsPerPixel As Integer
Dim viewPerspective As RasterViewPerspective
Dim sizeFlags As RasterSizeFlags
Dim value As RasterImage
 
value = instance.CreateThumbnail(thumbnailWidth, thumbnailHeight, bitsPerPixel, viewPerspective, sizeFlags)
C++/CLI 
public:
RasterImage^ CreateThumbnail( 
   int thumbnailWidth,
   int thumbnailHeight,
   int bitsPerPixel,
   RasterViewPerspective viewPerspective,
   RasterSizeFlags sizeFlags
) 

Parameters

thumbnailWidth
The desired maximum width of the thumbnail image in pixels.
thumbnailHeight
The desired maximum height of the thumbnail image in pixels.
bitsPerPixel
The desired bits per pixel.
viewPerspective
The desired view perspective.
sizeFlags
Flags that control the resize operation.

Return Value

A new RasterImage that is the thumbnail image.

Example

Visual BasicCopy Code
Public Sub CreateThumbnailExample()
   RasterCodecs.Startup()
   Dim codecs As RasterCodecs = New RasterCodecs()

   Dim srcFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "image1.cmp"

   ' Load the image
   Dim srcImage As RasterImage = codecs.Load(srcFileName)

   ' Use the CreateTumbnail method to create a thumbnail of this image
   Dim thumbnail As RasterImage = srcImage.CreateThumbnail(200, 200, 24, RasterViewPerspective.TopLeft, RasterSizeFlags.Bicubic)
   Debug.Assert(thumbnail.PageCount = 1)

   ' Clean up
   thumbnail.Dispose()
   srcImage.Dispose()
   codecs.Dispose()
   RasterCodecs.Shutdown()
End Sub
C#Copy Code
public void CreateThumbnailExample() 

   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = LeadtoolsExamples.Common.ImagesPath.Path + "image1.cmp"; 
 
   // Load the image 
   RasterImage srcImage = codecs.Load(srcFileName); 
 
   // Use the CreateTumbnail method to create a thumbnail of this image 
   RasterImage thumbnail = srcImage.CreateThumbnail(200,200,24,RasterViewPerspective.TopLeft,RasterSizeFlags.Bicubic); 
   Debug.Assert(thumbnail.PageCount == 1); 
 
   // Clean up 
   thumbnail.Dispose(); 
   srcImage.Dispose(); 
   codecs.Dispose(); 
   RasterCodecs.Shutdown(); 
}

Remarks

If the image width and height is less than thumbnailWidth and thumbnailHeight, then this method returns a copy of the image in the original size.

If the image width or height is greater than thumbnailWidth and thumbnailHeight, then this method will return the biggest thumbnail it can fit into the dimensions specified by thumbailWidth and thumbnailHeight, keeping the original image aspect ratio.

This method will never return a thumbnail bigger than the original image.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also