Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, September 25, 2018 10:10:41 AM(UTC)
Christopher

Groups: Registered, Tech Support, Administrators
Posts: 89

Was thanked: 4 time(s) in 4 post(s)

There are various pieces of information that are maintained and able to be retrieved in some file formats and images.

Below is example code that shows how to pull those pieces of information.
You will need to alter the file paths to point to your file as well as the License and Key files on your end.

In our LEADTOOLS Online Documentation you can find find explanations on these properties in the CodecsImageInfo class.
https://www.leadtools.co.../co/codecsimageinfo.html
https://www.leadtools.co...ageinfo--properties.html

A working version of the snippet below has been included at the bottom of the post.

C# snippet:
Code:
static void Main(string[] args)
{
	//Showcasing the CodecsImageInfo class:
	//https://www.leadtools.com/help/leadtools/v20/dh/co/codecsimageinfo.html

	//Set LEADTOOLS License and KEY
	string licenseFilePath = @"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC";
	string keyFileValue = File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY");
	RasterSupport.SetLicense(licenseFilePath, keyFileValue);

	string inputFile = @"C:\Users\Public\Documents\LEADTOOLS Images\Leadtools.pdf";
	using (RasterCodecs codecs = new RasterCodecs())
	using (CodecsImageInfo info = codecs.GetInformation(inputFile, true))
	{
		Console.WriteLine("Information for: {0}\n", inputFile);
		Console.WriteLine("File Name: {0}", info.Name);
		Console.WriteLine("BitsPerPixel: {0}", info.BitsPerPixel);
		Console.WriteLine("BytesPerLine: {0}", info.BytesPerLine);
		Console.WriteLine("Byte Order: {0}", info.Order);
		Console.WriteLine("Format: {0}", info.Format);

		Console.WriteLine("Has Alpha Channel: {0}", info.HasAlpha);
		Console.WriteLine("ColorSpace: {0}", info.ColorSpace.ToString());

		Console.WriteLine("Is a link: {0}", info.IsLink);
		Console.WriteLine("Is loaded: {0}", info.IsLoading);
		Console.WriteLine("Is rotated: {0}", info.IsRotated);
		Console.WriteLine("Is signed: {0}", info.IsSigned);

		//Save information
		Console.WriteLine("\n*Save information*");
		Console.WriteLine("Type of Compression: {0}", info.Compression);
		Console.WriteLine("Size on Disk: {0}", info.SizeDisk);
		Console.WriteLine("Size in Memory: {0}", info.SizeMemory);

		//Page Data
		Console.WriteLine("\n*Page information*");
		Console.WriteLine("Page Number: {0}", info.PageNumber);
		Console.WriteLine("Total Pages: {0}", info.TotalPages);
		Console.WriteLine("Horizonal Tiles: {0}", info.HorizontalTiles);
		Console.WriteLine("Vertical Tiles: {0}", info.VerticalTiles);
		Console.WriteLine("Image Perspective: {0}", info.ViewPerspective);

		//Dimensions
		Console.WriteLine("\n*Dimension information*");
		Console.WriteLine("Height: {0}", info.Height);
		Console.WriteLine("Width: {0}", info.Width);

		Console.WriteLine("Image Height: {0}", info.ImageHeight);
		Console.WriteLine("Image Width: {0}", info.ImageWidth);

		//Resolution
		Console.WriteLine("\n*Resolution information*");
		Console.WriteLine("Image has a Resolution {0}", info.HasResolution);
		Console.WriteLine("X Resolution: {0}", info.XResolution);
		Console.WriteLine("Y Resolution: {0}", info.YResolution);

		//Extended File Format specific info
		Console.WriteLine("\n*File Specific information*");
		Console.WriteLine("Document: {0}", info.Document);
		Console.WriteLine("Fax: {0}", info.Fax);
		Console.WriteLine("Gif: {0}", info.Gif);
		Console.WriteLine("Jpg: {0}", info.Jpeg);
		Console.WriteLine("Psd: {0}", info.Psd);
		Console.WriteLine("Pst: {0}", info.Pst);
		Console.WriteLine("Tif: {0}", info.Tiff);
		Console.WriteLine("Vector: {0}", info.Vector);
	}
	Console.ReadLine();
}


File Attachment(s):
simpleRasterCodecsInfo_20.zip (193kb) downloaded 203 time(s).
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.041 seconds.