User Guide > How to Work with... > Metadata > Use Simplified Access to Metadata |
ImageGear provides simplified API for accessing specific types of metadata. This API provides the ability to read and write metadata items without the need to know the exact location of these items in the metadata tree. ImGearMetadataHead Class contains accessor members that provide access to metadata structures, such as TIFF, EXIF, or IPTC. These accessors represent all standard metadata tags via their properties. Each property uses a specific type, corresponding to the metadata item type, as defined in the specification.
For example:
C# |
Copy Code |
---|---|
string ImageDescription = (page.Metadata.TIFF as ImGearTIFFMetadata).ImageDescription; |
A file does not have to include all of the metadata items that are defined by the standard. If a particular item is not present in the metadata tree, the corresponding property returns null. In order to allow such behavior for integers and other value types, corresponding properties use Nullable types.
C# |
Copy Code |
---|---|
ImGearTIFFOrientation igTIFFOrientation =
(igPage.Metadata.TIFF as ImGearTIFFMetadata).Orientation.GetValueOrDefault(ImGearTIFFOrientation.TopLeft); |
VB .NET |
Copy Code |
---|---|
Dim igTIFFOrientation As ImGearTIFFOrientation = DirectCast(igPage.Metadata.TIFF, ImGearTIFFMetadata).Orientation.GetValueOrDefault(ImGearTIFFOrientation.TopLeft) |
On the writing side, setting a property to some value replaces the existing value with a new one. Setting a property to null removes the corresponding item from the metadata tree.