ImageGear v26.3 - Updated
Developer Guide / How to Work with ... / Common Operations / Manipulating Image Data / Metadata / General Metadata API
In This Topic
    General Metadata API
    In This Topic

    ImageGear uses different storage for Document level metadata and Page level metadata:

    • Document level metadata is only used with file formats that are capable of storing multiple pages. This metadata includes only values that are common for all pages of the image.
    • Page level metadata is available for all file formats. It includes data that describes an image page.

    Different file formats use different metadata structures and tags. When saving an image to a file format that differs from the format of metadata attached to the image, the image's metadata is ignored, and default metadata is created instead.

    ImageGear uses a tree structure to store format metadata. All nodes of the metadata use a common parent class: ImGearMetadataNode Class. The two following classes are derived from it:

    A special node of type ImGearMetadataHead Class is always present in every ImGearPage Class and ImGearDocument Class as a class member. It cannot be attached to any metadata node, and it can only have one child. If the page (document) has metadata, then a metadata tree is attached to this Head node. Otherwise, the Head does not have child nodes.

    A node can be un-referenced or referenced from the one parent, but it cannot be referenced from multiple parents. The node cannot reference itself directly or indirectly. ImageGear checks this when the node is attached to another node. A metadata tree cannot be shared between multiple pages or documents.

    Every metadata node has Format Field of ImGearMetadataFormats Enumeration type. This allows you to store, for example, EXIF metadata under TIFF metadata. A Format Field value of ImGearMetadataFormats Enumeration.NONE can be used to indicate a custom/unknown format.

    The actual data in ImGearMetadataLeaf Class uses System.Object type. The NativeType Field of the ImGearMetadataLeaf Class object specifies the type of data that is used by a file format.

    Several leaves can reference the same object. ImageGear does not check or maintain consistency between an image and the metadata attached to it. For example, if an image loaded from a TIF file is resized, ImageGear does not update ImageWidth and ImageHeight tags in the image metadata. However, when you save this image, the correct values will be written to the file.

    Take a look at the ViewImagePropertiesAndMetadata sample for details of how to access the metadata tree.