Leadtools.Codecs Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.17
ReadLoadResolutions Method
See Also  Example
Leadtools.Codecs Namespace > RasterCodecs Class : ReadLoadResolutions Method




fileName
A String containing the name of the file to query.
Examines a FlashPix, PhotoCD, or JBIG file to determine which resolutions it contains.

Syntax

Visual Basic (Declaration) 
Public Function ReadLoadResolutions( _
   ByVal fileName As String _
) As Size()
Visual Basic (Usage)Copy Code
Dim instance As RasterCodecs
Dim fileName As String
Dim value() As Size
 
value = instance.ReadLoadResolutions(fileName)
C# 
public Size[] ReadLoadResolutions( 
   string fileName
)
Managed Extensions for C++ 
public: Size[] ReadLoadResolutions( 
   string* fileName
) 
C++/CLI 
public:
array<Size> ReadLoadResolutions( 
   String^ fileName
) 

Parameters

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

Return Value

An of Size structures containing the available resolutions.

Example

Visual BasicCopy Code
RasterCodecs.ReadLoadResolutions
      Private Sub ReadLoadResolutionsExample(ByVal jbigFileName As String)
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()
         ' Get the number of resolutions (sizes) available in this file
         Dim resolution As Size() = codecs.ReadLoadResolutions(jbigFileName)
         If resolution.Length > 0 Then
            Console.WriteLine("{0} resolutions available", resolution.Length)
            Dim i As Integer = 0
            Do While i < resolution.Length
               Console.WriteLine("{0} by {1}", resolution(i).Width, resolution(i).Height)
               i += 1
            Loop

            ' Set the size to load, the smallest size in this case */
            codecs.Options.Jpeg2000.Load.J2kResolution = resolution(0)

            ' Get the info about the image to show its original size
            Dim info As CodecsImageInfo = 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
            Dim image As RasterImage = 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")
         End If

         ' Clean up
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
RasterCodecs.ReadLoadResolutions 
      void ReadLoadResolutionsExample(string jbigFileName) 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         // Get the number of resolutions (sizes) available in this file 
         Size[] 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(); 
         RasterCodecs.Shutdown(); 
      }

Remarks

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

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also