What Is Image Metadata (Exif, IPTC, XMP, ICC) and How Do You Read or Edit It?

Updated

Image metadata is structured information embedded inside an image file rather than painted into its pixels. Exiv2, a cross-platform C++ library and command-line utility, reads and writes four common kinds: Exif, IPTC, XMP, and the ICC Profile. You can use it to inspect what a camera, editor, or scanner recorded, and to change those fields without re-encoding the image itself.

The four metadata types and what each one holds

They overlap in purpose but differ in origin, structure, and typical use.

Type Typical contents Format style Common origin
Exif Camera make/model, exposure, aperture, ISO, orientation, timestamps, GPS Binary tag/value pairs Camera or phone at capture
IPTC Caption, keywords, byline, credit, copyright, location text Older news-industry field set Photo editors, wire services
XMP Titles, descriptions, ratings, labels, edit history, rights XML-based, extensible Adobe tools and modern editors
ICC Profile Color space definition (e.g. sRGB, Adobe RGB) Binary color transform data Camera, scanner, or editing software

Exif is what most people mean by "photo metadata" — it is written automatically when a picture is taken. IPTC and XMP are more editorial: they describe who made the image, what it shows, and how it may be used. The ICC Profile is different in kind: it does not describe the scene, it tells software how to interpret the colors so they display consistently across devices.

Because XMP is XML, it can hold custom schemas and is the most flexible of the four. IPTC predates it and uses a fixed field structure, which is why many tools now mirror IPTC values into XMP for compatibility.

How metadata is stored inside image files

Metadata is not a separate sidecar by default — it lives in defined segments or blocks within the file:

  • JPEG: Exif sits in an APP1 segment; XMP also uses APP1; IPTC is carried in an APP13 (Photoshop) segment; the ICC Profile uses APP2.
  • TIFF: Exif and IPTC are stored as tagged directories; XMP is embedded as a tag.
  • PNG: metadata is held in named chunks (for example, text chunks for XMP and an iCCP chunk for the ICC Profile).

This matters because a tool must understand the container format, not just the metadata schema, to read or write correctly. Exiv2's stated scope is exactly this: read and write access to Exif, IPTC, XMP, and the ICC Profile embedded in images "in various formats."

Reading metadata with Exiv2

Exiv2 ships as both a library and a command-line utility. The command-line tool is the fastest way to see what is inside a file.

A typical read looks like this:

exiv2 image.jpg

Expected result: a printed list of metadata keys and values, grouped by family (Exif, IPTC, XMP). You use this to confirm what a file actually contains before editing — for example, to check whether GPS coordinates are present before publishing a photo.

To narrow the output, you can filter by metadata family or by a specific key. The exact option names are documented in the Exiv2 manual and API reference linked from the project site; check the version you have installed, since flags have changed across releases.

Editing metadata with Exiv2

Writing works by specifying a key and a new value, then saving:

exiv2 -M"set Exif.Image.Artist Jane Doe" image.jpg

Expected result: the Artist field is updated in the file. The same pattern applies to IPTC and XMP keys — you address the field by its family and name, and Exiv2 writes it back into the correct segment for that format.

Two practical points:

  • Back up first. Metadata edits rewrite parts of the file. Keep an untouched copy so you can compare or revert.
  • Verify after writing. Re-run the read command to confirm the value landed and that other fields were not disturbed.

For programmatic use, the C++ library exposes the same read/write model, which is why projects such as KDE, GNOME, GIMP, darktable, shotwell, GwenView, and Luminance HDR build on it.

Risks when modifying metadata

  • Loss of MakerNote data. Camera-specific MakerNote fields are proprietary and can be dropped or corrupted by tools that do not handle them. Exiv2 explicitly lists MakerNote support, but not every editor does.
  • Segment size limits. JPEG metadata segments have size ceilings; very large XMP blocks may not fit and can be truncated or rejected.
  • Format mismatch. Writing an IPTC-only field into a format that does not carry IPTC segments will fail or be silently ignored.
  • Color shifts. Replacing or removing an ICC Profile changes how the image is interpreted, even though the pixels are untouched.
  • Privacy exposure. GPS, timestamps, and device serial numbers are easy to read — and easy to forget to strip before sharing.

Choosing a library or tool

Weigh these factors against your task:

  • Coverage: does it handle all four types (Exif, IPTC, XMP, ICC), or only some?
  • Read vs. write: many viewers read metadata; fewer write it safely.
  • Format support: confirm it handles the containers you actually use (JPEG, TIFF, PNG, and others).
  • MakerNote handling: important if you edit files straight from a camera.
  • Licensing and integration: Exiv2 is described as free software with a C++ API, which suits embedding in an application; a standalone command-line tool suits one-off edits.
  • Maintenance: check the current release and changelog before committing to it.

Exiv2 fits tasks that need both reading and writing across Exif, IPTC, XMP, and ICC in a range of formats, whether from the command line or from C++ code. For a single quick caption change, a GUI editor may be simpler; for batch or scripted metadata work, a library-backed CLI is the more controllable choice.