Examines a page in a file to determine which resolutions it contains.
public LeadSize[] ReadLoadResolutions(string fileName,int pageNumber)
Public Overloads Function ReadLoadResolutions( _ByVal fileName As String, _ByVal pageNumber As Integer _) As Leadtools.LeadSize()
public [Leadtools.LeadSize[]](../l/leadsize.md) ReadLoadResolutions(string fileName,int pageNumber)
- (nullable NSArray<NSValue/*CGSize*/ *> *)loadResolutionsForFile:(NSString *)filepageNumber:(NSInteger)pageNumbererror:(NSError **)error
function Leadtools.Codecs.RasterCodecs.ReadLoadResolutions(String,Int32)(fileName ,pageNumber)
public:Leadtools.array<LeadSize>^ ReadLoadResolutions(String^ fileName,int pageNumber)
fileName
A String containing the name of the file to query.
pageNumber
An Int32 that indicates the page number.
A LeadSize structure containing the available resolutions.
A FlashPix, PhotoCD, ECW, JPEG 2000 or JBIG/JBIG2 file can contain more than one copy of the same image, each at a different physical resolution (width and height in pixels).
multi-page files (like TIF) containing compressions listed above (eg: JPEG 2000 or JBIG/JBIG2) can also contain more than one copy of the same image, each at a different physical resolution (width and height in pixels).
After you get the available resolutions, you can use any of the following to specify the one to be loaded:
The pages numbers start with 1, so set pageNumber to 2 to read the resolutions from the second page. If you set pageNumber to 1, the function behaves like the equivalent function without the pageNumber parameter.
For more information, refer to Implementing JBIG Features.
This example shows how many physical resolutions are available in page 2, selects the smallest one, then loads the file.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;using LeadtoolsExamples.Common;void ReadLoadResolutionsTiffExample(string tiffFileName, int pageNumber){RasterCodecs codecs = new RasterCodecs();// Get the number of resolutions (sizes) available in second page of this file// Make sure you run this for a tiff file with 2 pages, second page using JPEG 2000 compressionLeadSize[] resolution = codecs.ReadLoadResolutions(tiffFileName, pageNumber);if (resolution.Length > 0){Console.WriteLine("{0} resolutions available", resolution.Length);for (int i = 0; i < resolution.Length; i++)Console.WriteLine("{0}: {1} by {2}", i, resolution[i].Width, resolution[i].Height);// Set the size to load, the smallest size in this case */codecs.Options.Tiff.Load.J2kResolution = resolution[resolution.Length - 1];// Get the info in of the image to show its original sizeCodecsImageInfo info = codecs.GetInformation(tiffFileName, false, pageNumber);Console.WriteLine("Size of image according to GetInformation is {0} by {1}", info.Width, info.Height);// Load the image, keeping the bits per pixel of the fileRasterImage image = codecs.Load(tiffFileName, pageNumber);Console.WriteLine("Size of image loaded is {0} by {1}", image.Width, image.Height);image.Dispose();}elseConsole.WriteLine("No resolutions found");// Clean upcodecs.Dispose();}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.ColorImports Leadtools.DrawingImports Leadtools.SvgPrivate Sub ReadLoadResolutionsTiffExample(ByVal tiffFileName As String, ByVal pageNumber As Int32)Dim codecs As RasterCodecs = New RasterCodecs()' Get the number of resolutions (sizes) available in this fileDim resolution As LeadSize() = codecs.ReadLoadResolutions(tiffFileName, pageNumber)If resolution.Length > 0 ThenConsole.WriteLine("{0} resolutions available", resolution.Length)Dim i As Integer = 0Do While i < resolution.LengthConsole.WriteLine("{0}: {1} by {2}", i, resolution(i).Width, resolution(i).Height)i += 1Loop' Set the size to load, the smallest size in this case */codecs.Options.Tiff.Load.J2kResolution = resolution(resolution.Length - 1)' Get the info about the image to show its original sizeDim info As CodecsImageInfo = codecs.GetInformation(tiffFileName, False, pageNumber)Console.WriteLine("Size of image according to GetInformation is {0} by {1}", info.Width, info.Height)' Load the image, keeping the bits per pixel of the fileDim image As RasterImage = codecs.Load(tiffFileName, pageNumber)Console.WriteLine("Size of image loaded is {0} by {1}", image.Width, image.Height)image.Dispose()ElseConsole.WriteLine("No resolutions found")End If' Clean upcodecs.Dispose()End Sub
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
