←Select platform

CodecsImageInfo Class

Summary
Provides functionality for getting information about image files supported by LEADTOOLS.
Syntax
C#
VB
Objective-C
C++
Java
public class CodecsImageInfo : IDisposable 
Public Class CodecsImageInfo  
   Implements System.IDisposable  
@interface LTCodecsImageInfo : NSObject<NSCopying> 
public class CodecsImageInfo 
public ref class CodecsImageInfo : public System.IDisposable   
Remarks

Note: For information about loading PDF files, refer to Implementing PDF Features.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
 
 
public void CodecsImageInfoExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	// try a GIF 
	string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "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)); 
 
	// try a FAX TIFF 
	srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "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) 
	{ 
		Console.WriteLine(string.Format("X Resolution: {0}", info.XResolution)); 
		Console.WriteLine(string.Format("Y Resolution: {0}", info.YResolution)); 
	} 
	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())); 
	Console.WriteLine(string.Format("Tiff.IsBigTiff: {0}", info.Tiff.IsBigTiff.ToString())); 
 
	// try a PNG 
	srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "compression.png"); 
	info = codecs.GetInformation(srcFileName, true); 
	Console.WriteLine("Information for: {0}", srcFileName); 
	Console.WriteLine(string.Format("HasAlpha: {0}", info.HasAlpha.ToString())); 
 
	// try a DICOM 
	srcFileName = Path.Combine(LEAD_VARS.ImagesDir, @"DICOM","Image1.dcm"); 
	info = codecs.GetInformation(srcFileName, true); 
	Console.WriteLine("Information for: {0}", srcFileName); 
	Console.WriteLine(string.Format("IsSigned: {0}", info.IsSigned.ToString())); 
 
	// try a JPEG 
	srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "cannon.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)); 
 
	// try a PSD 
	srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.psd"); 
	info = codecs.GetInformation(srcFileName, true); 
	Console.WriteLine("Information for: {0}", srcFileName); 
	Console.WriteLine(string.Format("Psd.Layers: {0}", info.Psd.Layers)); 
 
	// try a BMP 
	srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Ulay1.bmp"); 
	info = codecs.GetInformation(srcFileName, true); 
	Console.WriteLine("Information for: {0}", srcFileName); 
	Console.WriteLine(string.Format("ViewPerspective: {0}", info.ViewPerspective)); 
 
	// Clean up 
	codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.