Fork me on GitHub

Introduction

The International Press Telecommunications Council (IPTC) published the IPTC Photo Metadata Standard at https://iptc.org/standards/photo-metadata. This standard provides a structure for fields and descriptions of how to use those fields in image metadata records in order to describe images accordingly. It also defines how to map NewsML-G2 XML document content to fields. This is where the metadata mapper comes into play.

The metadata mapper writes image metadata by extracting content elements from an XML document and mapping these elements to corresponding fields of the Information Interchange Model (IIM) records and Extensible Metadata Platform (XMP) of an JPEG image.

A metadata mapping is based on three files: an input XML, a JPEG file and a mapping configuration file. The configuration contains XPath expressions and relates them to primitive and complex fields of XMP and IIM image metadata. In this way the metadata mapper knows which content to extract out of the input XML file and how to map it to image metadata of the input JPEG file. The mapping configuration is documented in Mapping Configuration.

XML documents may contain encodings which are not suitable for the target image metadata field. Or in some cases you may have XML documents with mixed character sets and you do not want take over this mixture in the metadata of image. In such cases you may want to map and encode characters accordingly. The metadata mapper also supports configurable encoding and mapping of characters.

The implementation contains a mapping configuration which supports extraction of content out of NewsML G2 Profile 2 compliant documents and mapping it to to IIM and XMP fields according to IPTC "Photo Metadata" standard revision 1.2, October 2014. The source code contains an API (ImageMetadataOperation) as well as a Tool supporting simple command-line based operations.