CodecsImageInfo
Public Sub CodecsImageInfoExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
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))
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()))
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()))
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()))
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))
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))
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))
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub |