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




Provides functionality for getting information about image files supported by Leadtools.

Object Model






Syntax

Visual Basic (Declaration) 
Public Class CodecsImageInfo 
Visual Basic (Usage)Copy Code
Dim instance As CodecsImageInfo
C# 
public class CodecsImageInfo 
Managed Extensions for C++ 
public __gc class CodecsImageInfo 
C++/CLI 
public ref class CodecsImageInfo 

Example

Visual BasicCopy Code
CodecsImageInfo
      Public Sub CodecsImageInfoExample()
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()

         ' try a GIF
         Dim srcFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\eye.gif"
         Dim info As CodecsImageInfo = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("BitsPerPixel: {0}", info.BitsPerPixel))
         Console.WriteLine(String.Format("BytesPerLine: {0}", info.BytesPerLine))
         Console.WriteLine(String.Format("ColorSpace: {0}", info.ColorSpace.ToString()))
         Console.WriteLine(String.Format("Compresion: {0}", info.Compression))
         Console.WriteLine(String.Format("Fax: {0}", info.Fax))
         Console.WriteLine(String.Format("Format: {0}", info.Format))
         If info.Gif.HasAnimationBackground Then
            Console.WriteLine(String.Format("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString()))
         End If
         Console.WriteLine(String.Format("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight))
         Console.WriteLine(String.Format("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth))
         If info.Gif.HasAnimationLoop Then
            Console.WriteLine(String.Format("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString()))
         End If
         If info.Gif.HasAnimationPalette Then
            Dim pal As RasterColor() = info.Gif.GetAnimationPalette()
            Console.WriteLine("GifAnimationPalette:" & Constants.vbLf)
            Dim x As Integer = 0
            Do While x < pal.Length
               Console.Write("{0},", pal(x))
               x += 1
            Loop
            Console.WriteLine(Constants.vbLf)
         End If
         Console.WriteLine(String.Format("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString()))
         Console.WriteLine(String.Format("PageNumber: {0}", info.PageNumber))
         Console.WriteLine(String.Format("TotalPages: {0}", info.TotalPages))

         ' try a FAX TIFF
         srcFileName = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\OCR1.TIF"
         info = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("Width: {0}", info.Width))
         Console.WriteLine(String.Format("Height: {0}", info.Height))
         Console.WriteLine(String.Format("IsLink: {0}", info.IsLink.ToString()))
         Console.WriteLine(String.Format("IsRotated: {0}", info.IsRotated.ToString()))
         Console.WriteLine(String.Format("Fax.IsCompressed: {0}", info.Fax.IsCompressed.ToString()))
         If info.HasResolution Then
            Console.WriteLine(String.Format("X Resolution: {0}", info.XResolution))
            Console.WriteLine(String.Format("Y Resolution: {0}", info.YResolution))
         End If
         Console.WriteLine(String.Format("Tiff.HasNoPalette: {0}", info.Tiff.HasNoPalette.ToString()))
         Console.WriteLine(String.Format("Tiff.ImageFileDirectoryOffset: {0}", info.Tiff.ImageFileDirectoryOffset.ToString()))
         Console.WriteLine(String.Format("Tiff.IsImageFileDirectoryOffsetValid: {0}", info.Tiff.IsImageFileDirectoryOffsetValid.ToString()))

         ' try a PNG
         srcFileName = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\compression.png"
         info = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("HasAlpha: {0}", info.HasAlpha.ToString()))

         ' try a DICOM
         srcFileName = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.dic"
         info = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("IsSigned: {0}", info.IsSigned.ToString()))

         ' try a JPEG
         srcFileName = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Slave.jpg"
         info = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("Name: {0}", info.Name))
         Console.WriteLine(String.Format("Jpeg.HasStamp: {0}", info.Jpeg.HasStamp.ToString()))
         Console.WriteLine(String.Format("Jpeg.IsLossless: {0}", info.Jpeg.IsLossless.ToString()))
         Console.WriteLine(String.Format("Jpeg.IsProgressive: {0}", info.Jpeg.IsProgressive.ToString()))
         Console.WriteLine(String.Format("Order: {0}", info.Order.ToString()))
         Console.WriteLine(String.Format("SizeDisk: {0}", info.SizeDisk))
         Console.WriteLine(String.Format("SizeMemory: {0}", info.SizeMemory))

         ' try a PSD
         srcFileName = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.psd"
         info = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("Psd.Layers: {0}", info.Psd.Layers))

         ' try a BMP
         srcFileName = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Ulay1.bmp"
         info = codecs.GetInformation(srcFileName, True)
         Console.WriteLine("Information for: {0}", srcFileName)
         Console.WriteLine(String.Format("ViewPerspective: {0}", info.ViewPerspective))

         ' Clean up
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
CodecsImageInfo 
      public void CodecsImageInfoExample() 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
 
         // try a GIF 
         string srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\eye.gif"; 
         CodecsImageInfo info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("BitsPerPixel: {0}", info.BitsPerPixel)); 
         Console.WriteLine(string.Format("BytesPerLine: {0}", info.BytesPerLine)); 
         Console.WriteLine(string.Format("ColorSpace: {0}", info.ColorSpace.ToString())); 
         Console.WriteLine(string.Format("Compresion: {0}", info.Compression)); 
         Console.WriteLine(string.Format("Fax: {0}", info.Fax)); 
         Console.WriteLine(string.Format("Format: {0}", info.Format)); 
         if(info.Gif.HasAnimationBackground) 
            Console.WriteLine(string.Format("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString())); 
         Console.WriteLine(string.Format("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight)); 
         Console.WriteLine(string.Format("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth)); 
         if(info.Gif.HasAnimationLoop) 
            Console.WriteLine(string.Format("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString())); 
         if (info.Gif.HasAnimationPalette) 
         { 
            RasterColor[] pal = info.Gif.GetAnimationPalette(); 
            Console.WriteLine("GifAnimationPalette:\n"); 
            for(int x=0; x<pal.Length; x++) 
            { 
               Console.Write("{0},",pal[x]); 
            } 
            Console.WriteLine("\n"); 
         } 
         Console.WriteLine(string.Format("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString())); 
         Console.WriteLine(string.Format("PageNumber: {0}", info.PageNumber)); 
         Console.WriteLine(string.Format("TotalPages: {0}", info.TotalPages)); 
 
         // try a FAX TIFF 
         srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\OCR1.TIF"; 
         info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("Width: {0}", info.Width)); 
         Console.WriteLine(string.Format("Height: {0}", info.Height)); 
         Console.WriteLine(string.Format("IsLink: {0}", info.IsLink.ToString())); 
         Console.WriteLine(string.Format("IsRotated: {0}", info.IsRotated.ToString())); 
         Console.WriteLine(string.Format("Fax.IsCompressed: {0}", info.Fax.IsCompressed.ToString())); 
         if(info.HasResolution) 
         { 
            Console.WriteLine(string.Format("X Resolution: {0}", info.XResolution)); 
            Console.WriteLine(string.Format("Y Resolution: {0}", info.YResolution)); 
         } 
         Console.WriteLine(string.Format("Tiff.HasNoPalette: {0}", info.Tiff.HasNoPalette.ToString())); 
         Console.WriteLine(string.Format("Tiff.ImageFileDirectoryOffset: {0}", info.Tiff.ImageFileDirectoryOffset.ToString())); 
         Console.WriteLine(string.Format("Tiff.IsImageFileDirectoryOffsetValid: {0}", info.Tiff.IsImageFileDirectoryOffsetValid.ToString())); 
 
         // try a PNG 
         srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\compression.png"; 
         info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("HasAlpha: {0}", info.HasAlpha.ToString())); 
 
         // try a DICOM 
         srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.dic"; 
         info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("IsSigned: {0}", info.IsSigned.ToString())); 
 
         // try a JPEG 
         srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Slave.jpg"; 
         info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("Name: {0}", info.Name)); 
         Console.WriteLine(string.Format("Jpeg.HasStamp: {0}", info.Jpeg.HasStamp.ToString())); 
         Console.WriteLine(string.Format("Jpeg.IsLossless: {0}", info.Jpeg.IsLossless.ToString())); 
         Console.WriteLine(string.Format("Jpeg.IsProgressive: {0}", info.Jpeg.IsProgressive.ToString())); 
         Console.WriteLine(string.Format("Order: {0}", info.Order.ToString())); 
         Console.WriteLine(string.Format("SizeDisk: {0}", info.SizeDisk)); 
         Console.WriteLine(string.Format("SizeMemory: {0}", info.SizeMemory)); 
 
         // try a PSD 
         srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image1.psd"; 
         info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("Psd.Layers: {0}", info.Psd.Layers)); 
 
         // try a BMP 
         srcFileName = @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Ulay1.bmp"; 
         info = codecs.GetInformation(srcFileName, true); 
         Console.WriteLine("Information for: {0}", srcFileName); 
         Console.WriteLine(string.Format("ViewPerspective: {0}", info.ViewPerspective)); 
 
         // Clean up 
         codecs.Dispose(); 
         RasterCodecs.Shutdown(); 
      }

Inheritance Hierarchy

System.Object
   Leadtools.Codecs.CodecsImageInfo

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