public IList<RasterTagMetadata> ReadGeoKeys(Stream stream,int pageNumber)
- (nullable NSArray<LTRasterTagMetadata *> *)readGeoKeysFromStream:(LTLeadStream *)streampageNumber:(NSInteger)pageNumbererror:(NSError **)error
public List<RasterTagMetadata> readGeoKeys(ILeadStream stream, int pageNumber) public:IList<RasterTagMetadata^>^ ReadGeoKeys(Stream^ stream,int pageNumber)
def ReadGeoKeys(self,stream,pageNumber):
stream
A Stream containing the input TIFF image data.
pageNumber
1-based index of the page from which to read the GeoKey tags.
A collection of RasterTagMetadata containing all the GeoKey tags found in the file. If the file does not contain any GeoKeys, an empty collection will be returned. If the file format does not support GeoKeys, an exception will be thrown.
To read a specific GeoKey stored in a file, use ReadGeoKey and to enumerate all the GeoKeys stored in a file use EnumGeoKeys.
This method will throw an exception if the file format does not support GeoKeys. To determine whether a file format supports GeoKeys, use GeoKeysSupported. You can also automatically load all the GeoKeys stored in a file during a load operation by setting the CodecsLoadOptions.GeoKeys property to true. The GeoKeys data will be stored in the resulting image RasterImage.GeoKeys collection.
To load all the GeoKeys stored in a disk file, use ReadGeoKeys.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.ImageProcessing.Color;using Leadtools.Svg;public void MetadataLoadExample(){// Prompt the user for an image filestring imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "test_GeoKey.TIF");// Initialize LEADTOOLSusing (RasterCodecs codecs = new RasterCodecs()){// Get the file formatRasterImageFormat format;using (CodecsImageInfo info = codecs.GetInformation(imageFileName, false)){format = info.Format;}// Load the tagsIList<RasterTagMetadata> tags = null;if (RasterCodecs.TagsSupported(format))tags = codecs.ReadTags(imageFileName, 1);// Load the commentsIList<RasterCommentMetadata> comments = null;if (RasterCodecs.CommentsSupported(format))comments = codecs.ReadComments(imageFileName, 1);// Load the geo keysIList<RasterTagMetadata> geoKeys = null;if (RasterCodecs.GeoKeysSupported(format))geoKeys = codecs.ReadGeoKeys(imageFileName, 1);// Load the markersIList<RasterMarkerMetadata> markers = null;if (RasterCodecs.MarkersSupported(format))markers = codecs.ReadMarkers(imageFileName);string txtFileName = Path.Combine(Path.GetDirectoryName(imageFileName),Path.GetFileNameWithoutExtension(imageFileName) + "_metadata.txt");using (StreamWriter writer = File.CreateText(txtFileName)){// Write the tagsWriteTags(writer, "Tags", tags);// Write the commentsWriteComments(writer, comments);// Write the geo keys (tags and geokeys use the same data type)WriteTags(writer, "GeoKeys", geoKeys);// Write the markersWriteMarkers(writer, markers);}// Show the text file we createdTrace.Write(File.ReadAllText(txtFileName));}}private static void WriteTags(StreamWriter writer, string name, IList<RasterTagMetadata> tags){writer.WriteLine("{0}:", name);if (tags != null){foreach (RasterTagMetadata tag in tags){writer.WriteLine("Id: 0x{0}, data length: {1}", tag.Id.ToString("X"), tag.GetData().Length);}}else{writer.WriteLine("Not supported");}writer.WriteLine();}private static void WriteComments(StreamWriter writer, IList<RasterCommentMetadata> comments){writer.WriteLine("Comments:");if (comments != null){foreach (RasterCommentMetadata comment in comments){writer.WriteLine("Type: {0}, data length: {1}", comment.Type, comment.GetData().Length);}}else{writer.WriteLine("Not supported");}writer.WriteLine();}private static void WriteMarkers(StreamWriter writer, IList<RasterMarkerMetadata> markers){writer.WriteLine("Markers:");if (markers != null){foreach (RasterMarkerMetadata marker in markers){writer.WriteLine("ID: {0}, data length: {1}", marker.Id, marker.GetData().Length);}}else{writer.WriteLine("Not supported");}writer.WriteLine();}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";}
ReadGeoKeys(String,Int32) Method
EnumGeoKeys(String,Int32) Method
Implementing TIFF Comments and Tags
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
