VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000 Namespace / Jpeg2000Page Class
Members Example



In This Topic
    Jpeg2000Page Class
    In This Topic
    Represents a page of JPEG2000 file.
    Object Model
    Jpeg2000Page ClassPalette ClassResolution StructureImageFileSource Class
    Syntax
    'Declaration
     
    Public Class Jpeg2000Page 
       Inherits Vintasoft.Imaging.Codecs.ImageFiles.ImagePage
    public class Jpeg2000Page : Vintasoft.Imaging.Codecs.ImageFiles.ImagePage 
    public __gc class Jpeg2000Page : public Vintasoft.Imaging.Codecs.ImageFiles.ImagePage 
    public ref class Jpeg2000Page : public Vintasoft.Imaging.Codecs.ImageFiles.ImagePage 
    Example
    This example shows how to get an information about JPEG2000 page.
    ' Shows detailed information about parameters of Jpeg2000 page.
    Public Shared Sub ShowJpeg2000PageInfo(jpeg2000Filename As String)
        ' open an existing JPEG2000 file
        Using file As New Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File(jpeg2000Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
            ' get JPEG2000 page
            Dim page As Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000Page = file.Page
                
            ' get general image parameters
            System.Console.WriteLine(String.Format("Image dimensions: {0}x{1}", page.Width, page.Height))
            System.Console.WriteLine(String.Format("Image resolution: {0}x{1} dpi", System.Math.Round(page.Resolution.Horizontal), System.Math.Round(page.Resolution.Vertical)))
            System.Console.WriteLine(String.Format("Number of bits per pixel : {0}", page.BitsPerPixel))
                
            ' get information about palette
            If page.HasPalette Then
                System.Console.WriteLine(String.Format("Image has a palette with {0} colors", page.Palette.ColorCount))
            Else
                System.Console.WriteLine(String.Format("Image has no palette"))
            End If
                
            ' get specific JPEG2000 parameters
            System.Console.WriteLine(String.Format("Colorspace : {0}", page.ColorSpace))
            System.Console.WriteLine(String.Format("File format : {0}", page.FileFormat))
            System.Console.WriteLine(String.Format("Tile dimensions: {0}x{1}", page.TileWidth, page.TileHeight))
            System.Console.WriteLine(String.Format("Progression order : {0}", page.ProgressionOrder))
            System.Console.WriteLine(String.Format("Number of quality layers : {0}", page.QualityLayerCount))
            System.Console.WriteLine(String.Format("Number of wavelet levels : {0}", page.WaveletLevels))
                
            ' each comment is a separate string
            Dim comments As String() = page.GetComments()
                
            If comments.Length = 0 Then
                System.Console.WriteLine("There is no comments in codestream")
            Else
                System.Console.WriteLine("Comments in codestream:")
                
                For Each comment As String In comments
                    System.Console.WriteLine(comment)
                Next
            End If
        End Using
    End Sub
    // Shows detailed information about parameters of Jpeg2000 page.
    public static void ShowJpeg2000PageInfo(string jpeg2000Filename)
    {
        // open an existing JPEG2000 file
        using (Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File file =
            new Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000File(
                jpeg2000Filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
        {
            // get JPEG2000 page
            Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000Page page = file.Page;
                
            // get general image parameters
            System.Console.WriteLine(string.Format("Image dimensions: {0}x{1}", page.Width, page.Height));
            System.Console.WriteLine(string.Format("Image resolution: {0}x{1} dpi",
                System.Math.Round(page.Resolution.Horizontal),
                System.Math.Round(page.Resolution.Vertical)));
            System.Console.WriteLine(string.Format("Number of bits per pixel : {0}", page.BitsPerPixel));
                
            // get information about palette
            if (page.HasPalette)
                System.Console.WriteLine(string.Format("Image has a palette with {0} colors", page.Palette.ColorCount));
            else
                System.Console.WriteLine(string.Format("Image has no palette"));
                
            // get specific JPEG2000 parameters
            System.Console.WriteLine(string.Format("Colorspace : {0}", page.ColorSpace));
            System.Console.WriteLine(string.Format("File format : {0}", page.FileFormat));
            System.Console.WriteLine(string.Format("Tile dimensions: {0}x{1}", page.TileWidth, page.TileHeight));
            System.Console.WriteLine(string.Format("Progression order : {0}", page.ProgressionOrder));
            System.Console.WriteLine(string.Format("Number of quality layers : {0}", page.QualityLayerCount));
            System.Console.WriteLine(string.Format("Number of wavelet levels : {0}", page.WaveletLevels));
                
            // each comment is a separate string
            string[] comments = page.GetComments();
                
            if (comments.Length == 0)
            {
                System.Console.WriteLine("There is no comments in codestream");
            }
            else
            {
                System.Console.WriteLine("Comments in codestream:");
                
                foreach (string comment in comments)
                {
                    System.Console.WriteLine(comment);
                }
            }
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Codecs.ImageFiles.ImageFileBlock
          Vintasoft.Imaging.Codecs.ImageFiles.ImagePage
             Vintasoft.Imaging.Codecs.ImageFiles.Jpeg2000.Jpeg2000Page

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also