GetInformation(Stream,bool,int) Method (original) (raw)
Summary
Gets the specific image page information from a stream.
Syntax
C#
Objective-C
C++/CLI
Java
Python
- (nullable LTCodecsImageInfo *)imageInformationForStream:(LTLeadStream *)_stream_
totalPages:(BOOL)_totalPages_
pageNumber:(NSInteger)_pageNumber_
error:(NSError **)error
Parameters
stream
Stream containing the input image data.
totalPages
true to query the file for total number of pages; false, otherwise.
pageNumber
Page number in the file to query.
Return Value
A CodecsImageInfo object that contains the information about the specified image.
Example
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);
Debug.WriteLine("Information for: {0}", srcFileName);
Debug.WriteLine("BitsPerPixel: {0}", info.BitsPerPixel);
Debug.WriteLine("BytesPerLine: {0}", info.BytesPerLine);
Debug.WriteLine("ColorSpace: {0}", info.ColorSpace.ToString());
Debug.WriteLine("Compression: {0}", info.Compression);
Debug.WriteLine("Fax: {0}", info.Fax);
Debug.WriteLine("Format: {0}", info.Format);
if (info.Gif.HasAnimationBackground)
Debug.WriteLine("Gif.AnimationBackground: {0}", info.Gif.AnimationBackground.ToString());
Debug.WriteLine("Gif.AnimationHeight: {0}", info.Gif.AnimationHeight);
Debug.WriteLine("Gif.AnimationWidth: {0}", info.Gif.AnimationWidth);
if (info.Gif.HasAnimationLoop)
Debug.WriteLine("Gif.AnimationLoop: {0}", info.Gif.AnimationLoop.ToString());
if (info.Gif.HasAnimationPalette)
{
RasterColor[] pal = info.Gif.GetAnimationPalette();
Debug.WriteLine("GifAnimationPalette:\n");
for (int x = 0; x < pal.Length; x++)
{
Console.Write("{0},", pal[x]);
}
Debug.WriteLine("\n");
}
Debug.WriteLine("Gif.IsInterlaced: {0}", info.Gif.IsInterlaced.ToString());
Debug.WriteLine("PageNumber: {0}", info.PageNumber);
Debug.WriteLine("TotalPages: {0}", info.TotalPages);
// Clean up
codecs.Dispose();
fileInMemory.Close();
fileInMemory.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Leadtools.Codecs Assembly
CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method
CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method