Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.6.28
|
Leadtools Namespace > RasterImage Class : CreateThumbnail Method |
public RasterImage CreateThumbnail( int thumbnailWidth, int thumbnailHeight, int bitsPerPixel, RasterViewPerspective viewPerspective, RasterSizeFlags sizeFlags )
'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
'Usage
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)
public RasterImage CreateThumbnail( int thumbnailWidth, int thumbnailHeight, int bitsPerPixel, RasterViewPerspective viewPerspective, RasterSizeFlags sizeFlags )
- (nullable LTRasterImage *)createThumbnailWithWidth:(NSInteger)width thumbnailHeight:(NSInteger)height bitsPerPixel:(NSInteger)bitsPerPixel viewPerspectiveToUse:(LTRasterViewPerspective)viewPerspective sizeFlags:(LTRasterSizeFlags)sizeFlags error:(NSError ** )error
public RasterImage createThumbnail( int thumbnailWidth, int thumbnailHeight, int bitsPerPixel, RasterViewPerspective viewPerspective, RasterSizeFlags sizeFlags )
function Leadtools.RasterImage.CreateThumbnail( thumbnailWidth , thumbnailHeight , bitsPerPixel , viewPerspective , sizeFlags )
public: RasterImage^ CreateThumbnail( int thumbnailWidth, int thumbnailHeight, int bitsPerPixel, RasterViewPerspective viewPerspective, RasterSizeFlags sizeFlags )
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.
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Core Imports Leadtools.ImageProcessing.Color Imports Leadtools.Controls Imports Leadtools.Dicom Imports Leadtools.Drawing Imports Leadtools.Svg Public Sub CreateThumbnailExample() Dim codecs As RasterCodecs = New RasterCodecs() Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "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() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
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(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); Assert.IsTrue(thumbnail.PageCount == 1); // Clean up thumbnail.Dispose(); srcImage.Dispose(); codecs.Dispose(); }
RasterImageExamples.prototype.CreateThumbnailExample = function () { Tools.SetLicense(); var codecs = new Leadtools.Codecs.RasterCodecs(); var srcFileName = "Assets\\Image1.cmp"; // Load the image return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function ( loadFile ) { return codecs.loadAsync(Leadtools.LeadStreamFactory.create(loadFile));}) .then ( function (srcImage ){ // Use the CreateTumbnail method to create a thumbnail of this image var thumbnail = srcImage.createThumbnail(200, 200, 24, Leadtools.RasterViewPerspective.topLeft, Leadtools.RasterSizeFlags.bicubic); console.assert(thumbnail.pageCount == 1, "thumbnail.pageCount == 1"); // Clean up thumbnail.close(); srcImage.close(); codecs.close(); }); }
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Core; using Leadtools.ImageProcessing.Color; using Leadtools.Dicom; public async Task CreateThumbnailExample() { RasterCodecs codecs = new RasterCodecs(); string srcFileName = @"Assets\Image1.cmp"; // Load the image StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName); RasterImage srcImage = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)); // 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(); }
using Leadtools; using Leadtools.Codecs; using Leadtools.Dicom; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Core; using Leadtools.ImageProcessing.Color; using Leadtools.Examples; using Leadtools.Windows.Media; public void CreateThumbnailExample(RasterImage srcImage) { // 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(); }
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.Dicom Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Core Imports Leadtools.ImageProcessing.Color Imports Leadtools.Windows.Media Public Sub CreateThumbnailExample(ByVal srcImage As RasterImage) ' 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() End Sub