Creates a thumbnail from the specified image file.
public Leadtools.RasterImage ReadThumbnail(
string fileName,
Leadtools.Codecs.CodecsThumbnailOptions options,
int pageNumber
)
Public Overloads Function ReadThumbnail( _
ByVal fileName As String, _
ByVal options As Leadtools.Codecs.CodecsThumbnailOptions, _
ByVal pageNumber As Integer _
) As Leadtools.RasterImage
public Leadtools.RasterImage ReadThumbnail(
string fileName,
Leadtools.Codecs.CodecsThumbnailOptions options,
int pageNumber
)
- (nullable LTRasterImage *)readThumbnailFromFile:(NSString *)file
options:(LTCodecsThumbnailOptions *)thumbnailOptions
pageNumber:(NSInteger)pageNumber
error:(NSError **)error
function Leadtools.Codecs.RasterCodecs.ReadThumbnail(String,CodecsThumbnailOptions,Int32)(
fileName ,
options ,
pageNumber
)
public:
Leadtools.RasterImage^ ReadThumbnail(
String^ fileName,
Leadtools.Codecs.CodecsThumbnailOptions options,
int pageNumber
)
fileName
A String containing the name of the file from which the thumbnail image will be created.
options
Options for creating the thumbnail image.
pageNumber
1-based index of the page from which the thumbnail image should be created.
The RasterImage object that this method creates.
This method will always return a thumbnail image. Depending on the options passed, this method might read the stamp stored inside EXIF, CMP, JFIF and FlashPix files and return that. To read the file stamp only, use ReadStamp.
This example will read a thumbnail from a CMP file
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
using LeadtoolsExamples.Common;
public void ReadThumbnailExample()
{
RasterCodecs codecs = new RasterCodecs();
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
// Create a thumbnail with default options
CodecsThumbnailOptions options = CodecsThumbnailOptions.Default;
options.LoadStamp = false;
RasterImage thumbnail = codecs.ReadThumbnail(srcFileName, options, 1);
Console.WriteLine("Thumbnail with default option:");
Console.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel);
thumbnail.Dispose();
// Create a thumbnail with some options
options.LoadStamp = false;
options.Width = 40;
options.Height = 80;
options.ForceSize = true;
options.MaintainAspectRatio = false;
options.BackColor = RasterColor.FromKnownColor(RasterKnownColor.LightBlue);
options.BitsPerPixel = 8;
thumbnail = codecs.ReadThumbnail(srcFileName, options, 1);
Console.WriteLine("Thumbnail with set option (size: {0} by {1}, Bits/Pixel: {2}, ForeSize: {3}",
options.Width, options.Height, options.BitsPerPixel, options.ForceSize);
Console.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel);
thumbnail.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Imports Leadtools.Svg
Public Sub ReadThumbnailExample()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")
' Create a thumbnail with default options
Dim options As CodecsThumbnailOptions = CodecsThumbnailOptions.Default
options.LoadStamp = False
Dim thumbnail As RasterImage = codecs.ReadThumbnail(srcFileName, options, 1)
Console.WriteLine("Thumbnail with default option:")
Console.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel)
thumbnail.Dispose()
' Create a thumbnail with some options
options.LoadStamp = False
options.Width = 40
options.Height = 80
options.ForceSize = True
options.MaintainAspectRatio = False
options.BackColor = RasterColor.FromKnownColor(RasterKnownColor.LightBlue)
options.BitsPerPixel = 8
thumbnail = codecs.ReadThumbnail(srcFileName, options, 1)
Console.WriteLine("Thumbnail with set option (size: {0} by {1}, Bits/Pixel: {2}, ForeSize: {3}", options.Width, options.Height, options.BitsPerPixel, options.ForceSize)
Console.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel)
thumbnail.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.Examples;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Windows.Media;
public void ReadThumbnailExample(Stream inStreamCmp)
{
RasterCodecs codecs = new RasterCodecs();
// Create a thumbnail with default options
CodecsThumbnailOptions options = CodecsThumbnailOptions.Default;
options.LoadStamp = false;
RasterImage thumbnail = codecs.ReadThumbnail(inStreamCmp, options, 1);
Debug.WriteLine("Thumbnail with default option:");
Debug.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel);
thumbnail.Dispose();
// Create a thumbnail with some options
options.LoadStamp = false;
options.Width = 40;
options.Height = 80;
options.ForceSize = true;
options.MaintainAspectRatio = false;
options.BackColor = new RasterColor(0x00, 0x00, 0x7F);
options.BitsPerPixel = 8;
thumbnail = codecs.ReadThumbnail(inStreamCmp, options, 1);
Debug.WriteLine("Thumbnail with set option (size: {0} by {1}, Bits/Pixel: {2}, ForeSize: {3}",
options.Width, options.Height, options.BitsPerPixel, options.ForceSize);
Debug.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel);
thumbnail.Dispose();
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Windows.Media
Public Sub ReadThumbnailExample(ByVal inStreamCmp As Stream)
Dim codecs As RasterCodecs = New RasterCodecs()
' Create a thumbnail with default options
Dim options As CodecsThumbnailOptions = CodecsThumbnailOptions.Default
options.LoadStamp = False
Dim thumbnail As RasterImage = codecs.ReadThumbnail(inStreamCmp, options, 1)
Debug.WriteLine("Thumbnail with default option:")
Debug.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel)
thumbnail.Dispose()
' Create a thumbnail with some options
options.LoadStamp = False
options.Width = 40
options.Height = 80
options.ForceSize = True
options.MaintainAspectRatio = False
options.BackColor = New RasterColor(&H0, &H0, &H7F)
options.BitsPerPixel = 8
thumbnail = codecs.ReadThumbnail(inStreamCmp, options, 1)
Debug.WriteLine("Thumbnail with set option (size: {0} by {1}, Bits/Pixel: {2}, ForeSize: {3}", options.Width, options.Height, options.BitsPerPixel, options.ForceSize)
Debug.WriteLine(" Size: {0} by {1} pixels. Bits/Pixel: {2}", thumbnail.Width, thumbnail.Height, thumbnail.BitsPerPixel)
thumbnail.Dispose()
End Sub
Products |
Support |
Feedback: ReadThumbnail(String,CodecsThumbnailOptions,Int32) Method - Leadtools.Codecs |
Introduction |
Help Version 19.0.2017.6.16
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.