←Select platform

GetInformation(Stream,bool) Method

Summary
Gets the image information from a stream.
Syntax
C#
VB
Objective-C
C++
Java
public CodecsImageInfo GetInformation( 
   Stream stream, 
   bool totalPages 
) 
Public Overloads Function GetInformation( _ 
   ByVal stream As Stream, _ 
   ByVal totalPages As Boolean _ 
) As CodecsImageInfo 
- (nullable LTCodecsImageInfo *)imageInformationForStream:(LTLeadStream *)stream  
                                               totalPages:(BOOL)totalPages  
                                                    error:(NSError **)error 
public CodecsImageInfo getInformation(ILeadStream stream, boolean totalPages) 
public: 
CodecsImageInfo^ GetInformation(  
   Stream^ stream, 
   bool totalPages 
)  

Parameters

stream
Stream containing the input image data.

totalPages
true to query the file for total number of pages; false, otherwise.

Return Value

A CodecsImageInfo object that contains the information about the specified image.

Remarks

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.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
public void GetInformationStreamExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	// Get Information on a GIF image file and write it out 
	string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "eye.gif"); 
	FileStream fileInMemory = new FileStream(srcFileName, FileMode.Open); 
 
	CodecsImageInfo info = codecs.GetInformation(fileInMemory, 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 up 
	codecs.Dispose(); 
	fileInMemory.Close(); 
	fileInMemory.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 21.0.2021.3.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Codecs Assembly