←Select platform

ReadLoadResolutions(string) Method

Summary
Examines a file to determine which resolutions it contains.
Syntax
C#
VB
Objective-C
C++
public LeadSize[] ReadLoadResolutions( 
   string fileName 
) 
Public Overloads Function ReadLoadResolutions( _ 
   ByVal fileName As String _ 
) As LeadSize() 
- (nullable NSArray<NSValue/*CGSize*/ *> *)loadResolutionsForFile:(NSString *)file error:(NSError **)error 
public: 
array<LeadSize>^ ReadLoadResolutions(  
   String^ fileName 
)  

Parameters

fileName
A String containing the name of the file to query.

Return Value

A LeadSize structure containing the available resolutions.

Remarks

A FlashPix, PhotoCD, 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).

After you get the available resolutions, you can use any of the following to specify the one to be loaded:

For more information, refer to Implementing JBIG Features.

Example

This example shows how many physical resolutions are available, selects the smallest one, then loads the file.

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
void ReadLoadResolutionsExample(string jbigFileName) 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	// Get the number of resolutions (sizes) available in this file 
	LeadSize[] resolution = codecs.ReadLoadResolutions(jbigFileName); 
	if (resolution.Length > 0) 
	{ 
		Console.WriteLine("{0} resolutions available", resolution.Length); 
		for (int i = 0; i < resolution.Length; i++) 
			Console.WriteLine("{0} by {1}", resolution[i].Width, resolution[i].Height); 
 
		// Set the size to load, the smallest size in this case */ 
		codecs.Options.Jpeg2000.Load.J2kResolution = resolution[0]; 
 
		// Get the info in of the image to show its original size 
		CodecsImageInfo info = codecs.GetInformation(jbigFileName, false); 
		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 file 
		RasterImage image = codecs.Load(jbigFileName); 
		Console.WriteLine("Size of image loaded is {0} by {1}", image.Width, image.Height); 
 
		image.Dispose(); 
	} 
	else 
		Console.WriteLine("No resolutions found"); 
 
	// Clean up 
	codecs.Dispose(); 
} 
Requirements

Target Platforms

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

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