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)
|
Parameters
- fileName
- A String containing the name of the file to query.
Return Value
An of
Size structures containing the available resolutions.
Example
Visual Basic | Copy Code |
---|
RasterCodecs.ReadLoadResolutions
Private Sub ReadLoadResolutionsExample(ByVal jbigFileName As String)
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
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
codecs.Options.Jpeg2000.Load.J2kResolution = resolution(0)
Dim info As CodecsImageInfo = codecs.GetInformation(jbigFileName, False)
Console.WriteLine("Size of image according to GetInformation is {0} by {1}", info.Width, info.Height)
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
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
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