XMP Metadata

This document is meant as a short 4D Developer’s Guide to XMP Metadata.

The authoritative reference documentation on XMP can be found at Adobe’s XMP Developer Center. Wikipedia also has a good article on XMP, worth reading to get familiar with the platform. So, what is XMP anyway?

  • XMP = Extensible Metadata Platform;
  • Initially developed by Adobe, now ISO standard;
  • The Esperando of metadata: accommodates traditional metadata (Exif, JPEG/TIFF comments, IPTC) in a uniform and extensible format;
  • Agnostic of platform and image format.

The XMP Packet

XMP metadata in their raw form are organized in a packet. The XMP packet is actually an XML instance (RDF, specifically).

The XMP packet is presented to the application as a hierarchy of properties. The raw form of the packet is also available as RDF text.


XMP Properties

XMP properties have the following attributes:

  • Namespace
  • Name
  • Type

Namespace

Namespaces are used in XMP just like in XML: to group properties into schemas (Dublin Core, Exif, etc.), and to avoid name collisions.

Each namespace has a unique identifier in the form of a URI, and a prefix. The use of namespace prefixes makes it much easier to address properties; it is easier to use "dc:" instead of "http://purl.org/dc/elements/1.1/:".

Name, Prefix and Full Name

The property name prefixed with the property’s namespace prefix form its full name. For example, the full name of the "author" property in the Dublin Core namespace is "dc:author".

Type

The type of a XMP property can be one of these:

Simple A simple textual value. Simple properties are always the leaves in the property hierarchy tree.
Structure A collection of properties indexed by name. Similar to 4D’s C_OBJECT‘s.
Array An ordered collection of properties indexed by number (the position in the collection). Similar to 4D arrays.
Bag An unordered array.
LangAlt

A collection of text entries indexed by their RFC 3066 language code. Used to store multi-language text values.

The "x-default" language is a special entry in all LangAlt properties that contains the default property value when an entry for a specific language is missing.

The root of the property hierarchy is always a structure.

Properties at the root of the hierarchy are addressed by their full name. For example, use "exif:UserComment" to access the Exif comment property.

Properties nested in the hierarchy are addressed by their full path. For example, use "exif:Flash/exif:Fired" to access the Exif flash fired property.

Properties contained in Array and Bag containers are addressed by appending the property index in square brackets to the container’s full name. For example, use "exif:SubjectLocation[1]" to address the first element of the "exif:SubjectLocation" array.


XMP Schemas

Metadata properties are grouped into schemas, identified by their namespace.

The XMP specification includes definitions for a number of schemas commonly used with images and other document kinds. Applications are free to define and implement custom schemas.

A schema defines its properties, their types and containment structure, and how simple properties should be interpreted (metadata on metadata).

A schema classifies the values of its properties into simple, derived, and complex value types. The most common of these types are listed below. For details, see “Part 1, Data model, Serialization, and Core Properties” at Adobe’s XMP Developer Center.

Furthermore, a schema specifies whether a property is external (read editable) or not.

Common Simple Value Types

Text A possibly empty Unicode string.
Boolean "True" or "False".
Integer A signed or unsigned numeric string used as an integer number representation. The string consists of an arbitrary length decimal numeric string with an optional leading "+" or "–" sign.
Real A simple text value denoting a floating-point numeric value, written using decimal notation of an optional sign followed by an integer part and a fraction part. Either the integer part or the fraction part, but not both, may be omitted. The sign, if present, is "+" or "-". The integer part, if present, is a sequence of one or more decimal digits. The fraction, if present, is a decimal point (".") followed by a sequence of one or more decimal digits.
Rational A simple text value denoting a floating-point numeric value in the form of a rational number: nominator/denominator.
Date

A date-time value in the ISO 8601 format:

  • YYYY
  • YYYY-MM
  • YYYY-MM-DD
  • YYYY-MM-DDThh:mmTZD
  • YYYY-MM-DDThh:mm:ssTZD
  • YYYY-MM-DDThh:mm:ss.sTZD

Where:

  • YYYY = four-digit year
  • MM = two-digit month (01 = January)
  • DD = two-digit day of month (01 through 31)
  • hh = two digits of hour (00 through 23)
  • mm = two digits of minute (00 through 59)
  • ss = two digits of second (00 through 59)
  • s = one or more digits representing a decimal fraction of a second
  • TZD = time zone designator (Z or +hh:mm or -hh:mm)

The time zone designator need not be present in XMP. When not present, the time zone is unknown, and the application should not assume anything about the missing time zone.

Local time-zone designators +hh:mm or -hh:mm should be used when possible instead of converting to UTC.

Common Derived Value Types

Choice

A value chosen from a vocabulary of values. Vocabularies provide a means of specifying a limited and possibly extensible set of values for a property.

A choice can be open or closed:

  • An open choice has one or more lists of preferred values, but other values can be used freely.
  • A closed choice has one or more lists of allowed values, other values shall not be used.

A vocabulary may be just a list of values to be used in the property, for example the "xmpDM:key" property from the XMP Dynamic Media namespace takes its values from vocabulary ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"].

A vocabulary may also contain values that are looked up in a list of more descriptive texts. As an example, the "exif:ExposureMode" property from the Exif namespace takes its values from ["0", "1", "2"] but these are looked up in dictionary {"0": "Auto exposure", "1": "Manual exposure", "2": "Auto bracket"} for display and data entry purposes.

AgentName The name of an XMP processor (application). The recommended format is Organization Software_name Version (token;token;...). For example, "Adobe Acrobat 9.0 (Mac OS X 10.5)".
GUID A string representing a globally unique identifier.
ProperName A simple text value denoting the name of a person or organization.
URI An Internet Uniform Resource Identifier as defined in RFC 3986.
URL An Internet Uniform Resource Locator.

Complex Value Types

These are collections of properties grouped as members of structure properties, thus defining the hierarchical organization of the schema.

As an example, the "exif:Flash" property is a complex property (a structure) containing the following simple properties:

"exif:Function" Boolean
"exif:Fired" Boolean
"exif:RedEyeMode" Boolean
"exif:Mode"
Choice of:
  • "0": "Unknown"
  • "1": "Compulsory flash firing"
  • "2": "Compulsory flash suppression"
  • "3": "Auto mode"
"exif:Return"
Choice of:
  • "0": "No strobe return detection"
  • "2": "Strobe return light not detected"
  • "3": "Strobe return light detected"

XMP in Q2Pix

Q2Pix utilizes Adobe’s XMP Toolkit SDK combined with facilities provided by system frameworks on each platform, and offers a detailed API and other services for reading, examining, manipulating, and writing XMP metadata in image files.

The plug-in provides methods for:

  • Registering XMP namespaces;
  • Reading and writing XMP data from/to image files and RDF text;
  • Inspecting the XMP property tree;
  • Inserting, removing, and modifying XMP properties of any type;
  • Copying property subtrees;
  • Applying a template XMP data object to another;
  • Parsing and converting XMP dates.

Additionally, the Q2XMPLib component provides a generic and extensible XMP editor dialog that can be invoked with a single line of code. The editor is driven by schema definition files (JSON) bundled within the component.

See the Working with XMP metadata section in the Programming Guide for more details, and the documentation for the XMP methods in the plug-in and component API reference.