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




Gets the image information from a disk file.

Overload List

OverloadDescription
GetInformation(String,Boolean) Gets the image information from a disk file.  
GetInformation(String,Boolean,Int32) Gets the specific image page information from a disk file.  
GetInformation(Stream,Boolean) Gets the image information from a stream.  
GetInformation(Stream,Boolean,Int32) Gets the specific image page information from a stream.  
GetInformation(Uri,Boolean) Gets the specific image page information from the specified Uri.  
GetInformation(Uri,Boolean,Int32) Gets the specific image page information from the specified Uri.  

Example

Visual BasicCopy Code
RasterCodecs.GetInformationString
      Public Sub GetInformationStringExample()
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()

         ' Get Information on a GIF image file and write it out
         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))

         ' Clean up
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
RasterCodecs.GetInformationString 
      public void GetInformationStringExample() 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
 
         // Get Information on a GIF image file and write it out 
         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)); 
 
         // Clean up 
         codecs.Dispose(); 
         RasterCodecs.Shutdown(); 
      }

Remarks

Specifying true for totalPages can cause the process to be slow for files with large number of pages.

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