←Select platform

CreateThumbnail Method

Summary
Creates a thumbnail image of this RasterImage.
Syntax
C#
Objective-C
C++/CLI
Java
Python
- (nullable LTRasterImage *)createThumbnailWithWidth:(NSInteger)width  
                                     thumbnailHeight:(NSInteger)height  
                                        bitsPerPixel:(NSInteger)bitsPerPixel  
                                viewPerspectiveToUse:(LTRasterViewPerspective)viewPerspective  
                                           sizeFlags:(LTRasterSizeFlags)sizeFlags  
                                               error:(NSError ** )error 

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.

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.

The result image will always have a resolution of 96 by 96 regardless of the resolution this RasterImage and will never return a thumbnail bigger than the original image.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using Leadtools.Svg; 
 
 
public void CreateThumbnailExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "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); 
	Assert.IsTrue(thumbnail.PageCount == 1); 
 
	// Clean up 
	thumbnail.Dispose(); 
	srcImage.Dispose(); 
	codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.5.16
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.