←Select platform

ReadLoadResolutions(Stream,int) Method

Summary
Examines a stream to determine which resolutions it contains.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public LeadSize[] ReadLoadResolutions( 
   Stream stream, 
   int pageNumber 
) 
- (nullable NSArray<NSValue/*CGSize*/ *> *)loadResolutionsForStream:(LTLeadStream *)stream 
                                                               pageNumber:(NSInteger)pageNumber  
                                                                    error:(NSError **)error 
public LeadSize[] readLoadResolutions(ILeadStream stream, int page) 
public: 
array<LeadSize>^ ReadLoadResolutions(  
   Stream^ stream, 
   int pageNumber 
)  
def ReadLoadResolutions(self,stream,pageNumber): 

Parameters

stream
A Stream containing the data of the image file to query.

pageNumber
An Int32 that indicates the page number.

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).

multipage 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.

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
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) 
   { 
      Debug.WriteLine("{0} resolutions available", resolution.Length); 
      for (int i = 0; i < resolution.Length; i++) 
         Debug.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); 
      Debug.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); 
      Debug.WriteLine("Size of image loaded is {0} by {1}", image.Width, image.Height); 
 
      image.Dispose(); 
   } 
   else 
      Debug.WriteLine("No resolutions found"); 
 
   // Clean up 
   codecs.Dispose(); 
} 
Requirements

Target Platforms

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

Leadtools.Codecs Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.