What Is EXIF Metadata and How Do You Read or Edit It?

Updated

EXIF metadata is a structured block of information stored inside an image file that records how and when the photo was taken — camera model, exposure settings, timestamps, orientation, and often GPS coordinates. You can read it with a command-line tool or library, and you can edit or remove individual tags, but you should always work on a copy because writing metadata back into a file can fail or corrupt data depending on the format and the specific tags involved. This applies to JPEG, TIFF, and many RAW formats; the exact set of writable tags varies by file type.

Where EXIF Lives and What It Contains

EXIF is one metadata family among several. A single image commonly carries:

Metadata family Typical contents
EXIF Camera make/model, exposure time, aperture, ISO, focal length, orientation, timestamp, GPS
IPTC Caption, keywords, credits, copyright — used in editorial workflows
XMP Extensible, XML-based metadata; increasingly used for ratings, labels, and editing history
ICC Profile Color space description used to render colors correctly

Exiv2, a cross-platform C++ library and command-line utility, reads and writes Exif, IPTC, and XMP metadata plus the ICC Profile embedded in digital images across various formats. It is free software and is used in projects including KDE and GNOME desktops, and in applications such as GIMP, darktable, shotwell, GwenView, and Luminance HDR.

The practical consequence: when you "edit EXIF," you are usually editing one block while the others stay untouched. A tool that only handles EXIF will not show you the IPTC caption or the XMP rating sitting in the same file.

Reading Metadata Before You Change Anything

Always inspect first. Reading tells you which tags exist, what values they hold, and whether the file even has the metadata you expect.

The general workflow:

  1. Identify the file format — JPEG, TIFF, and RAW formats store metadata differently, and some tags are format-specific.
  2. Dump all metadata with a command-line utility so you see EXIF, IPTC, and XMP together rather than one family at a time.
  3. Note the exact tag names you intend to change. Tag naming differs between tools (for example, a human-readable name versus a numeric tag ID).
  4. Check for a MakerNote — a vendor-specific block that many cameras write and that some tools cannot safely rewrite.

Expected result: a readable listing of tags and values. If a tag you expected is missing, the camera may not have written it, or the file may have been stripped by an earlier export or upload step.

Editing or Stripping Tags

Once you know what is there, editing is a matter of targeting specific tags and writing the file back.

  • Change a value — set a single tag (for example, a copyright string or a timestamp) and save.
  • Strip everything — remove all metadata, useful before publishing images that contain GPS coordinates or serial numbers.
  • Strip selectively — remove only GPS or only MakerNote data while keeping exposure settings intact.

Two rules make this safe:

  1. Keep a backup of the original. Metadata writing modifies the file in place in many workflows; if the write fails midway, the original is your only recovery path.
  2. Verify after writing. Re-read the file with the same tool and confirm the tag now holds the value you set. A silent failure — where the command reports success but the tag is unchanged — is a real outcome on some formats.

Common Pitfalls

MakerNote quirks. MakerNotes are proprietary, undocumented blocks. Their internal layout can differ between camera models and even firmware versions. A tool may read a MakerNote correctly but refuse to write it, or write it in a way the camera's own software no longer recognizes. If preserving MakerNote data matters, test on a copy and confirm with a second tool.

Format-specific limits. Not every tag is writable in every container. Some formats support only a subset of EXIF fields, and some metadata families may not be writable at all in a given file type. The tool's documentation is the authority here, not assumptions carried over from JPEG.

Conflicting metadata. If EXIF and XMP both carry a timestamp or orientation value, different applications may prefer different sources. Editing one and not the other can produce inconsistent behavior across viewers.

Orientation tags. Changing an orientation tag without physically rotating pixels can make an image display differently in some viewers and correctly in others. Decide whether you are correcting the tag or the pixels — they are separate operations.

Choosing a Tool

For scripted or batch work, a command-line utility is the practical choice: it composes with shell loops, runs headless, and produces output you can diff. For application development, a library gives you programmatic read/write access to the same metadata families. Exiv2 covers both roles — a C++ library plus a command-line utility — which means the tag semantics you learn on the command line carry over to code that uses the library.

If you only need to read metadata occasionally, any viewer that displays EXIF will do. The moment you need to write, strip, or batch-process, move to a tool that documents which tags it can write for which formats.