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,
int sizeFlags
);
public:
RasterImage^ CreateThumbnail(
int thumbnailWidth,
int thumbnailHeight,
int bitsPerPixel,
RasterViewPerspective viewPerspective,
RasterSizeFlags sizeFlags
)
def CreateThumbnail(self,thumbnailWidth,thumbnailHeight,bitsPerPixel,viewPerspective,sizeFlags):
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.
A new RasterImage that is the thumbnail image.
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.
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:\LEADTOOLS23\Resources\Images";
}
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.core.*;
import leadtools.svg.*;
import leadtools.imageprocessing.CloneCommand;
import leadtools.imageprocessing.FillCommand;
import leadtools.imageprocessing.FlipCommand;
import leadtools.imageprocessing.GrayscaleCommand;
import leadtools.imageprocessing.color.InvertCommand;
import leadtools.imageprocessing.color.PosterizeCommand;
public void createThumbnailExample() {
final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
RasterCodecs codecs = new RasterCodecs();
String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "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.TOP_LEFT,
RasterSizeFlags.BICUBIC.getValue());
assertTrue(thumbnail.getPageCount() == 1);
// Save it
codecs.save(srcImage, srcFileName, RasterImageFormat.CMP, 0);
// Clean up
thumbnail.dispose();
srcImage.dispose();
codecs.dispose();
assertTrue("file unsuccessfully saved to " + srcFileName, (new File(srcFileName)).exists());
System.out.printf("File saved successfully to %s%n", srcFileName);
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document