What Is XMP Metadata and How Do You Read or Edit It in Images?
Updated
XMP (Extensible Metadata Platform) is an XML-based metadata standard originally developed by Adobe that can be embedded in image files such as JPEG, TIFF, and PNG. You read or edit it with tools that understand the XMP packet structure — for example, the Exiv2 command-line utility or its C++ library, which provides read and write access to Exif, IPTC, and XMP metadata and the ICC Profile in a wide range of image formats. This article explains what XMP contains, how it differs from Exif and IPTC, and how to inspect and modify it.
What XMP actually stores
XMP is a structured, extensible format rather than a fixed field list. It is organized into namespaces, each covering a category of information:
| Namespace | Typical content |
|---|---|
| Dublin Core | Title, creator, description, rights, subject keywords |
| Photoshop | Editing history, color mode, legacy IPTC fields |
| Camera Raw | Develop settings applied by raw converters |
| XMP Basic | Create/modify dates, creator tool, rating, label |
Because XMP is XML, it can hold nested structures, arrays, and language alternatives that flat formats cannot express well. It is also designed to be extended — new namespaces can be added without breaking existing readers.
How XMP differs from Exif and IPTC
These three metadata families often coexist in the same file, but they serve different purposes:
- Exif — camera-generated capture data: exposure time, aperture, ISO, lens, orientation, GPS.
- IPTC — descriptive and rights information historically used in news and publishing workflows: captions, bylines, credit lines, copyright.
- XMP — a broader container that can carry descriptive, rights, editing, and workflow data, and can also mirror or replace legacy IPTC fields.
In practice, XMP is the most flexible of the three and is often where modern applications write their own information. A single image may carry all three, so an edit to one does not automatically update the others.
Reading XMP from an image
Using Exiv2 as an example, the general workflow is:
- Identify the file and its metadata. Run a command that prints all metadata blocks so you can see whether an XMP packet exists and which namespaces are present. The expected result is a listing of Exif, IPTC, and XMP sections with their keys and values.
- Filter to XMP only. Narrow the output to XMP keys so you can read specific fields such as title, creator, or rating without scrolling through Exif tags.
- Check for conflicts. If the same information appears in both IPTC and XMP, note which one your downstream application reads before deciding what to change.
The exact command syntax depends on the Exiv2 version; consult the project's manual and examples for the current flags rather than relying on memorized options.
Editing XMP
Editing follows the inverse path:
- Back up the original file before writing, since metadata edits modify the file in place.
- Set the target field using the tool's write command, specifying the XMP namespace and property.
- Verify the result by reading the file back and confirming the new value appears and that Exif and IPTC blocks are still intact.
A few practical cautions:
- Preserve existing Exif/IPTC data. Some operations can drop or overwrite blocks if not handled carefully. Always re-read the file after writing to confirm nothing was lost.
- Watch for duplicate representations. If your workflow reads IPTC but you only updated XMP, the change may not be visible where you expect it.
- Respect namespace prefixes. Writing to the wrong namespace (for example, a Photoshop field instead of Dublin Core) produces a valid file that your target application may ignore.
Choosing a tool
Exiv2 is a cross-platform C++ library and command-line utility that reads and writes Exif, IPTC, and XMP metadata plus the ICC Profile, and it is used in projects including KDE, GNOME, GIMP, darktable, shotwell, GwenView, and Luminance HDR. It is available as free software, with downloads and documentation on the project site. For scripted or batch metadata work it is a reasonable default; for interactive editing, a GUI application built on the same libraries may be more convenient.