Представляет страницу файла JPEG2000.
Вот C#/VB.NET код, который демонстрирует, как получить информацию о странице JPEG2000.
' 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);
}
}
}
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5