ImageGear v26.4 - Updated
Developer Guide / How to Work with ... / Common Operations / Manipulate Image Data / Metadata
In This Topic
    Metadata
    In This Topic

    What Is Metadata?

    Metadata is non-image data, often available in some complex formats like TIFF or PNG. It may have complexity and is completely dependent on the nature of the file format. Such complex file formats as EXIF, TIFF, JPEG-JFIF, PNG and some others contain a lot of metadata. ImageGear provides functionality to read the metadata during image loading, to store it with the image in memory, and modify metadata during image saving.

    Common Metadata

    ImageGear uses its Metadata API to provide information that is common for all image file formats: compression type, number of layers of a page, and color profile. Use ImGearMetadataHead.Common Property to access common metadata.

    Manipulating Metadata

    To provide a way of manipulating metadata, ImageGear offers a set of classes composed from ImGearMetadataNode Class, ImGearMetadataNodeList Class and ImGearMetadataTree Class and their descendants. For a particular ImGearPage Class instance, metadata may be accessed through the Metadata Property.

    ImageGear provides two sets of API for working with non-image data:

    • General Metadata API provides unified access to metadata of all supported image formats. Non-image data itself can be of any possible complex type and completely depends on the nature of the file format itself. ImageGear processes this complex data through a single interface and provides uniform processing that does not depend on the actual data format and varies from information fields of such simple formats as BMP and PCX, up to the complex EXIF and IPTC metadata support in such filters as TIFF and JPEG.
    • Simplified Metadata API provides access to standard tags of specific complex formats, such as TIFF, EXIF, and IPTC. It takes care of the location of particular tags in the metadata tree, decodes and encodes complex metadata values, and provides structures and enumerations for data types according to the metadata standard.

    ImageGear is responsible for translating this format-dependent data into a standard uniform format. As soon as an image is loaded, its metadata is accessible through ImGearPage.Metadata Property and ImGearDocument.Metadata Property objects.

    You do not need to load image pixels to obtain the non-image data. Use ImGearFileFormats.LoadPageHeader Method to load DIB info and metadata without loading pixel data.

    XMP Metadata

    Extensible Metadata Platform (XMP) is an XML-based standard for storage and interchange of metadata, developed by Adobe Systems, Inc. The standard defines the rules for storage and processing of metadata, and provides a number of schemas for storage of information that is typically associated with images and documents, such as Title, Author, Creation date/time, Rating, etc. Applications can add custom schemas to store additional information.

    XMP metadata can be attached to files of various formats, such as TIFF, PNG, GIF, DNG, JPEG, PDF, PostScript.

    ImageGear provides the following ways for working with XMP metadata:

    • Accessing XMP properties via the ImageGear Metadata API. In this mode, ImageGear decodes XMP properties and accumulates them in the metadata structure, which is attached to the ImGearPage object when working with the raster formats or ImGearDocument object when working with PDF or PostScript. Then, the application can access individual properties in one of the two ways:
      • General Metadata API. In this mode, the application works with a tree structure containing XMP properties. This mode supports arbitrary XMP schemas. However, working in this mode requires that the application developer has some knowledge of both the XMP standard and particular schemas. See Access XMP Tags via General Metadata for information.
      • Simplified Metadata API. In this mode, the application works with classes that allow simple access to particular properties, without the need to know details of the XMP standard, and with only a minimal knowledge of XMP schemas. Simplified API only supports schemas that are known to ImageGear. See the description of ImGearXMPMetadataRoot Class for a list of supported schemas. See Access XMP Tags via Simplified Metadata for information.
    • Working with unprocessed XMP metadata. In this mode, ImageGear passes XMP to the application as a single byte array containing XMP tags. The application can parse this array using a third party XML parser. On the writing side, the application prepares an array containing XMP tags, and passes it to ImageGear. Unprocessed XMP metadata can be accessed via the metadata structure of the containing format, such as TIFF or JPEG, using General Metadata API. The metadata tree will contain only the XMP tag, containing a binary array.

    By default, ImageGear parses the XMP stream into its metadata structure, and does not provide the Raw XMP stream. If you don't want ImageGear to parse the XMP stream, and prefer to access the unprocessed XMP stream, set ImGearLoadOptions.ParseXMP Property to false.

    During saving, if an XMP tag contains a tree, ImageGear serializes the tree into an XMP stream. Alternatively, if XMP tag contains a byte array, ImageGear saves this array verbatim.

    XMP Metadata in PDF and PS

    ImageGear PDF component reads the XMP metadata attached to a PDF and PS document, and writes it back when the document is saved. Metadata extracted from a PDF or PS/EPS file is attached to the whole ImageGear document as a common ImageGear metadata tree, which can be processed with General or Simplified Metadata API. The XMP metadata tree is not attached to pages, because it is related to the whole document.

    When the ImageGear PDF component creates a new PDF document, it creates and attaches a default XMP tree containing the following schemas: Dublin CoreBasic XMPAdobe PDF, and Media Management. This set of schemas is also automatically populated when a PDF document is created with Acrobat.

    The ImageGear PDF component also provides the ImGearPDFDocument.SetInfo and ImGearPDFDocument.GetInfo methods to work with non-XMP PDF metadata. That metadata is stored in a PDF Document Information Dictionary, which is separate from the XMP stream. However, for consistency reasons, SetInfo updates the metadata in both the XMP tree and the Document Information Dictionary storages, and GetInfo accesses the data from the XMP metadata tree.

    See Also

    Metadata Structures