MetaData
Metadata are data embedded within image files that give various information about the camera and the image itself. For example, for pictures taken by a camera, you can find optics aperture, exposition, camera model, white balance, etc.
Most importantly, for the purpose of our color correction pipeline, metadata can also embed the color profile of the image. This is mainly these metadata we will be talking about.
Also, we will not focus on how to read the metadata from a particular image file type because Nuaj' is now using WIC to read its bitmaps and WIC provides easy access to decoded metadata.
Sometimes, the color profile information is as simple as the RGB/White chromaticities as can be found with Standard Profiles or other simple, custom profiles. Check the Color Transforms page to know how to compute the RGB ↔ XYZ transform matrices from such chromaticities.
You can also find gamma information tied to the profile to understand what gamma correction should apply to the input colors.
For more complex color profiling, you can sometimes find the entire ICC profile embedded as metadata. All you have to do is then decode the ICC profile and apply it to the color data to transform the colors in CIEXYZ space. We won't be expanding much on this subject as it's too large for our purpose but you can refer to the Custom ICC Profiles section for more information.
Metadata Types
Let's describe the common types of metadata, in order of relevance to color correction.
IPTC
(Source: http://en.wikipedia.org/wiki/IPTC_Information_Interchange_Model)
NOTE: IPTC is then mainly used for informal, human-readable text and doesn't involve color management so we will not linger on reading it. Moreover, the XMP standard that we will see below can encapsulate IPTC so you can skip this section altogether.
The Information Interchange Model (IIM) is a file structure and set of metadata attributes that can be applied to text, images and other media types. It was developed in the early 1990s by the International Press Telecommunications Council (IPTC) to expedite the international exchange of news among newspapers and news agencies.
IIM metadata embedded in images are often referred to as "IPTC headers", and can be easily encoded and decoded by most popular photo editing software. The Extensible Metadata Platform (XMP) has largely superseded IIM's file structure, but the IIM image attributes are defined in the IPTC Core schema for XMP and most image manipulation programs keep the XMP and non-XMP IPTC attributes synchronized.
In 2001, Adobe introduced "Extensible Metadata Platform" (XMP), which is an XML schema for the same types of metadata as IPTC, but is based on XML/RDF, and is therefore inherently extensible. The effort spawned a collaboration with the IPTC, eventually producing the "IPTC Core Schema for XMP", which merges the two approaches to embedded metadata. The XMP specification describes techniques for embedding metadata in JPEG, TIFF, JPEG2000, GIF, PNG, HTML, PostScript, PDF, SVG, Adobe Illustrator, and DNG files.
EXIF
(Source: http://en.wikipedia.org/wiki/Exchangeable_image_file_format)
EXchangeable Image File format (EXIF) can be found in TIFF and JPEG but not in PNG or GIF.
The EXIF is constantly maintained to keep up to date contrary to XMP that is inherently extensible due to the use of XML.
(Source: http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-008-2010_E.pdf)
Concerning color management, we can find the following data:
- Transfer Function, a transfer function for the image described in tabular style (3*256 bytes). Normally this tag need not be used, since color space is specified in the color space information tag below (indeed, I've never encountered that tag).
- White Point, the chromaticity of the white point of the image. Normally this tag need not be used, since color space is specified in the color space information tag below.
- Primary Chromaticities, the chromaticities of the 3 primary colors of the image. Normally this tag need not be used, since color space is specified in the color space information tag below.
- Color Space, the color space information tag is always recorded as the color space specifier. Normally, sRGB (=1) is used to define the color space based on the PC monitor conditions and environment. If a color space other than sRGB is used, Uncalibrated (=65535) is set (NOTE: I sometimes found Adobe RGB (=2) as an unofficial color space value).
- Gamma, indicates the value of coefficient gamma.
We could also use the Light Source tag describing the illuminant used for taking the snapshot (cf. pp.55-56 for a list of possible illuminants). Anwyay, this would only apply to a direct usage of non-processed photographs, which is very unlikely in a pipeline like 3D rendering.
XMP
(Source: http://en.wikipedia.org/wiki/Extensible_Metadata_Platform)
Extensible Metadata Platform (XMP) is a standard, created by Adobe Systems Inc., for processing and storing standardized and proprietary information relating to the contents of a file.
Serialized XMP can be embedded into a significant number of popular file formats, without breaking their readability by non-XMP-aware applications. Embedding metadata avoids many problems that occur when metadata is stored separately.
XMP can be used in several file formats such as PDF, JPEG, JPEG 2000, JPEG XR, GIF, PNG, HTML, TIFF, Adobe Illustrator, PSD, MP3, MP4, Audio Video Interleave, WAV, RF64, Audio Interchange File Format, PostScript, Encapsulated PostScript, and proposed for DjVu. In a typical edited JPEG file, XMP information is typically included alongside Exif and IPTC Information Interchange Model data.
XMP metadata can describe a document as a whole (the "main" metadata), but can also describe parts of a document, such as pages or included images. This architecture makes it possible to retain authorship and rights information about, for example, images included in a published document. Similarly, it permits documents created from several smaller documents to retain the original metadata associated with the parts.
We can find everything we need about decoding the XMP metadata from http://www.adobe.com/products/xmp/index.html where an open-source SDK can be downloaded.