Gets the image information from a disk file.
public CodecsImageInfo GetInformation(string fileName,bool totalPages)
Public Overloads Function GetInformation( _ByVal fileName As String, _ByVal totalPages As Boolean _) As CodecsImageInfo
- (nullable LTCodecsImageInfo *)imageInformationForFile:(NSString *)filetotalPages:(BOOL)totalPageserror:(NSError **)error
public:CodecsImageInfo^ GetInformation(String^ fileName,bool totalPages)
fileName
String containing the input file name to query.
totalPages
true to query the file for total number of pages; false, otherwise.
A CodecsImageInfo object that contains the information about the specified image.
Specifying true for totalPages can cause the process to be slow for files with large number of pages.
To quickly query the number of an image, use GetTotalPages or GetTotalPagesAsync.
To quickly query the format of an image, use GetFormat or GetFormatAsync.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;using LeadtoolsExamples.Common;public void GetInformationStringExample(){RasterCodecs codecs = new RasterCodecs();// Get Information on a GIF image file and write it outstring srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif");CodecsImageInfo info = codecs.GetInformation(srcFileName, true);Console.WriteLine("Information for: {0}", srcFileName);Console.WriteLine("BitsPerPixel: {0}", info.BitsPerPixel);Console.WriteLine("BytesPerLine: {0}", info.BytesPerLine);Console.WriteLine("ColorSpace: {0}", info.ColorSpace.ToString());Console.WriteLine("Compression: {0}", info.Compression);Console.WriteLine("Fax: {0}", info.Fax);Console.WriteLine("Format: {0}", info.Format);if (info.Gif.HasAnimationBackground)Console.WriteLine("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString());Console.WriteLine("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight);Console.WriteLine("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth);if (info.Gif.HasAnimationLoop)Console.WriteLine("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("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString());Console.WriteLine("PageNumber: {0}", info.PageNumber);Console.WriteLine("TotalPages: {0}", info.TotalPages);// Clean upcodecs.Dispose();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingImports Leadtools.ImageProcessing.ColorImports Leadtools.DrawingImports Leadtools.SvgPublic Sub GetInformationStringExample()Dim codecs As RasterCodecs = New RasterCodecs()' Get Information on a GIF image file and write it outDim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif")Dim info As CodecsImageInfo = codecs.GetInformation(srcFileName, True)Console.WriteLine("Information for: {0}", srcFileName)Console.WriteLine("BitsPerPixel: {0}", info.BitsPerPixel)Console.WriteLine("BytesPerLine: {0}", info.BytesPerLine)Console.WriteLine("ColorSpace: {0}", info.ColorSpace.ToString())Console.WriteLine("Compression: {0}", info.Compression)Console.WriteLine("Fax: {0}", info.Fax)Console.WriteLine("Format: {0}", info.Format)If info.Gif.HasAnimationBackground ThenConsole.WriteLine("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString())End IfConsole.WriteLine("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight)Console.WriteLine("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth)If info.Gif.HasAnimationLoop ThenConsole.WriteLine("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString())End IfIf info.Gif.HasAnimationPalette ThenDim pal As RasterColor() = info.Gif.GetAnimationPalette()Console.WriteLine("GifAnimationPalette:" & Constants.vbLf)Dim x As Integer = 0Do While x < pal.LengthConsole.Write("{0},", pal(x))x += 1LoopConsole.WriteLine(Constants.vbLf)End IfConsole.WriteLine("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString())Console.WriteLine("PageNumber: {0}", info.PageNumber)Console.WriteLine("TotalPages: {0}", info.TotalPages)' Clean upcodecs.Dispose()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
