ImageGear .NET v25.0 - Updated
Metadata
User Guide > How to Work with... > Common Operations > Manipulating Image Data > Metadata

This topic provides information about the following:

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 .NET 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 .NET 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 .NET provides two sets of API for working with non-image data:

ImageGear .NET 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, PSD, PDF, PostScript, JP2 and JPX.

ImageGear provides the following ways for working with XMP metadata:

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 .NET 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 .NET 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 .NET 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