Other ExifTool User Guide chapters

Introduction

As outlined in the Main overview calling ExifTool on the command line is the typical way of using it.

This chapter explains how to build a command line along many different use cases.

Terminology

This "metadata thing you can fill in" has many different names: field, property, tag …​ - and all name the same!
The IPTC Photo Metadata Standard uses the term property.
In this ExifTool User Guide we use the more popular term field.
If the User Guide talks about a "this metadata thing" in the context of ExifTool its preferred term tag is used.

ExifTool identifiers and names of metadata fields

ExifTool Tag Name

ExifTool defines a name for all the fields defined by a standard as a short and spaceless string called Tag Name. An overview of all Tag Names can be found at https://exiftool.org/TagNames/. These Tag Names are very close to names specified by a metadata standard but they must not include any blank spaces and some appear to be too long. This resulted in slightly different Tag Names.

ExifTool Tag identifier

ExifTool is able to provide a full identification of a metadata field: its Tag Name in any case, in addition the identifier of the metadata format standard the field comes from and in some cases a namespace inside this metadata format standard.

How ExifTool builds a full identifier from such part is set by the -G parameter on the command line: it sets the "group name" used by ExifTool.

IPTC is using the -G1 parameter as default setting to select the "group family number" 1.
Setting the -G1 parameter for reading and showing embedded metadata the identifier of a metadata field is build this way:

  • First part: The identifier of the data format standard this field comes from. For example: IPTC for the IPTC IIM format, XMP for the ISO/Adobe XMP format, IFD0 or ExifIFD for the Exif format …​ and others.

  • If the metadata format standard uses namespaces - like XMP - the short name (aka alias) of this namespace is appended with a hyphen as sepator

  • Separator: In any case a colon : comes next as separator

  • Final part: the ExifTool Tag Name of the field

  • Examples:

    • XMP-iptcExt:DigitalSourceType resolves to XMP as data format standard, iptcExt stands for the IPTC Extension namespace in XMP, DigitalSourceType is the Tag Name for the IPTC field Digital Source Type

    • IPTC:Credit resolves to IPTC standing for IPTC IIM as data format standard, Credit is the Tag Name for the IPTC field Credit.

This rule for building identifiers applies to metadata fields at the top level only. Any metadata field inside a structure - a sub-field of another property - has the Tag Name only.

How to find ExifTool Tag Names

From an IPTC Photo Metadata field to the ExifTool Tag Name

If you want to know which ExifTool Tag Name is used for a known IPTC Photo Metadata field do this:

  • Go to the IPTC specification at https://iptc.org/std/photometadata/specification/IPTC-PhotoMetadata

  • Search for the IPTC field you are interested in (in the left sidebar, click on its name) and have a look at its specification table

  • Each specification table has a row Help: ExifTool tags: in the second column the [ExifTool tag identifier] for XMP is shown and if this IPTC field uses also the IPTC IIM format the [ExifTool tag identifier] for the IIM format is shown. To the right of the /-separator the data type of the value is shown:

    • nothing is shown there : a single string

    • array: multiple string values

    • decimal: a decimal number, e.g. 1.0 or 2.5

From an ExifTool Tag Name to the specified name

If you have found an ExifTool identifier with a Tag Name in the output of ExifTool and you want to know its name defined by the metadata standard do this:

Find the specified name

If the first part of the identifier is IPTC the IPTC IIM metadata format is used, details of Tag Names in its context can be found at https://exiftool.org/TagNames/IPTC.html

If the very first part of the identifier is XMP the XMP metadata format is used, detail can be found at https://exiftool.org/TagNames/XMP.html and they are grouped by namespaces as defined by different standards.
For IPTC Photo Metadata fields these namespaces are used, find it to the right of XMP- in the first part of the identifier. Follow the namespace link to the right to see all Tag Names of each:

ExifTool’s simplified vocabulary values

The values of some IPTC metadata fields have to be taken from a controlled vocabulary. A controlled vocabulary is a set of terms, each ones has an identifier and a human free-text name. In the context of Semantic Technology many modern vocabularies use a URL as identifier - this way identifiers may get quite long. Phil Harvey, the maker of ExifTool, told us that for the ease of users he implemented short versions of a long identifier as the to-be-used value of a field - for some, but not all IPTC Photo Metadata fields.

Example:
As value of the Data Mining field this term may be used:
- Identifier: https://ns.useplus.org/ldf/vocab/DMI-PROHIBITED-GENAIMLTRAINING
- Name: Prohibited for Generative AI/ML training

For the use of short identifiers the ExifTool parameter -n needs to be set. Else ExifTool delivers (when reading) and expects (for writing) the free-text name of the term.

ExifTool defines that the string DMI-PROHIBITED-GENAIMLTRAINING must be used as value of the Data Mining field for the purpose "Prohibited for Generative AI/ML training".
This string is also shown by ExifTool if metadata are read from an image file! But a deep check of the embedded metadata shows that the full URL is embedded.

The ExifTool-values for the fields Data Mining, Minor Model Age Disclosure, Model Release Status, Property Release Status and Licensor Telephone Type are shown on that page: https://exiftool.org/TagNames/PLUS.html .

The ExifTool-values for the field Image Region Boundary Shape, Image Region Boundary Unit are shown in the IPTC Extension Tags section of the XMP Tag Names page https://exiftool.org/TagNames/XMP.html#iptcExt

For all other metadata fields requiring a value from a controlled vocabulary like the Digital Source Type the identifier must be used as defined by the vocabulary.

Viewing/reading Use Cases

Generic ExifTool parameters

IPTC recommends using this basic set of ExifTool parameters for reading metadata from an image file:

exiftool -j -struct -G1 -n …​..

These parameters are used:

  • -j = use the JSON format for the output. The set of all metadata fields of a file are a JSON object which is the only member of an array. Each JSON property has a name defined as field identifier by ExifTool.

  • -struct = shows structured data in a structured way.
    Example: the IPTC Photo Metadata has the Image Creator and this is a structure of a Name and an Identifier field. If also the -j parameter is used the JSON property name is the identifier for Image Creator and the value of this JSON property is a JSON object with two properties: one for the Name and one for the Identfier. This way IPTC fields with a set of sub-fields can be made perfectly visible.

  • -G1 = ExifTool name group family 1. Find more about its details in [ExifTool tag identifier]

  • -n = use the short identifiers of ExifTool’s simplified vocabulary values and not the free-text name of the controlled vocabulary value

View all embedded metadata for an image file

A simple starting point for using ExifTool is reading and showing metadata of any standard embedded into an image file:

exiftool -j -struct -G1 -n <image file name>

If you want to write the shown JSON data to a file use this commmand:

exiftool -j -struct -G1 -n <image file name> -w -out.json

The JSON file has the file name of the image file with -out.json appended to it.

The resulting JSON looks like this one

[{
  "SourceFile": "<image file name>",
  "XMP-dc:Subject": ["Keyword1","Keyword2","Keyword3"],
  ... (and maybe many other fields)
}]

The JSON property "SourceFile" holds the file name of the image from which the embedded metadata was read.

View a single metadata field in an image file

ExifTool can extract any single property from a media file. To find out which tag to use see From an IPTC Photo Metadata field to the ExifTool Tag Name.

Show only Digital Source Type value

exiftool -j -struct -G1 -n -XMP-iptcExt:digitalsourcetype <file name>

  1. you have to use the ExifTool identifier -XMP-iptcExt:digitalsourcetype as a parameter to the command line.

[{
  "SourceFile": "<file name>",
  "XMP-iptcExt:DigitalSourceType": "http://cv.iptc.org/newscodes/digitalsourcetype/softwareImage"
}]

Show only the Credit Line value

exiftool -j -struct -G1 -n -XMP-photoshop:Credit <file name>

[{
  "SourceFile": "<file name>",
  "XMP-photoshop:Credit": "ABC Images/Emile Muller"
}]

Show only the Keywords - with multiple values

exiftool -j -struct -G1 -n -XMP-dc:Subject <file name>

[{
  "SourceFile": "<file name>",
  "XMP-dc:Subject": ["Keyword1","Keyword2","Keyword3"]
}]

If multiple values are available they are shown with double-quotes, separated by a comma and inside []-brackets - in JSON terms they are shown as array.

Show only the Location Created - with a structured value

exiftool -j -struct -G1 -n -XMP-iptcExt:LocationCreated <file name>

[{
  "SourceFile": "<file name>",
  "XMP-iptcExt:LocationCreated": [{
    "City": "City of Vienna",
    "CountryCode": "AUT",
    "CountryName": "Austria",
    "GPSAltitude": 190,
    "GPSLatitude": 48.2352,
    "GPSLongitude": 16.3322,
    "LocationId": ["http://www.wikidata.org/entity/Q2464508"],
    "LocationName": "Türkenschanzpark",
    "ProvinceState": "Vienna",
    "Sublocation": "Türkenschanzpark",
    "WorldRegion": "Europe"
  }]
}]

View multiple metadata fields in an image file

exiftool -j -struct -G1 -n -XMP-photoshop:Credit -XMP-dc:Subject <file name>

INFO: You have to use a sequence of tag identifiers separated by a space.

[{
  "SourceFile": "<file name>",
  "XMP-photoshop:Credit": "Wedding Photos International/Joan Daverne",
  "XMP-dc:Subject": ["wedding","park","sunshine"]
}]

View the XMP Packet inside an image file

The full XMP packet as embedded into an image file can be shown by this command line:

exiftool -b -xmp <file name>

<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.72'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

 <rdf:Description rdf:about=''
  xmlns:Iptc4xmpCore='http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'>
  <Iptc4xmpCore:AltTextAccessibility>
   <rdf:Alt>
    <rdf:li xml:lang='x-default'>A small pond in front of bushes and lawn. In the middle of the pond a fountain.</rdf:li>
    <rdf:li xml:lang='en'>A small pond in front of bushes and lawn. In the middle of the pond a fountain.</rdf:li>
   </rdf:Alt>
  </Iptc4xmpCore:AltTextAccessibility>
  <Iptc4xmpCore:CountryCode>AUT</Iptc4xmpCore:CountryCode>
  <Iptc4xmpCore:ExtDescrAccessibility>
   <rdf:Alt>
    <rdf:li xml:lang='x-default'>Some people take a rest on the lawn and stare on their smartphones. Sunlight and a fog of water create a rainbow.</rdf:li>
    <rdf:li xml:lang='en'>Some people take a rest on the lawn and stare on their smartphones. Sunlight and a fog of water create a rainbow.</rdf:li>
   </rdf:Alt>
  </Iptc4xmpCore:ExtDescrAccessibility>
  <Iptc4xmpCore:IntellectualGenre>Preview</Iptc4xmpCore:IntellectualGenre>
  <Iptc4xmpCore:Location>Türkenschanzpark</Iptc4xmpCore:Location>
  <Iptc4xmpCore:SubjectCode>
   <rdf:Bag>
    <rdf:li>10020231</rdf:li>
   </rdf:Bag>
  </Iptc4xmpCore:SubjectCode>
 </rdf:Description>

 <!-- other XMP namespaces may be shown here -->

 <rdf:Description rdf:about=''
  xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
  <xmp:Rating>1.0</xmp:Rating>
 </rdf:Description>
 <rdf:Description rdf:about=''
  xmlns:xmpRights='http://ns.adobe.com/xap/1.0/rights/'>
  <xmpRights:UsageTerms>
   <rdf:Alt>
    <rdf:li xml:lang='x-default'>No image may be published without paying a license fee</rdf:li>
   </rdf:Alt>
  </xmpRights:UsageTerms>
  <xmpRights:WebStatement>https://wedphoint.example.com/WebStatementOfRights</xmpRights:WebStatement>
 </rdf:Description>
</rdf:RDF>
</x:xmpmeta>

Writing Use Cases

IPTC recommends to use this distinction for writing photo metadata with ExifTool

  • Writing a single plain value to a field. The requirements of this use are:

    • The field takes a plain value, not a structure

    • The field takes only a single value, not a sequence/array of values

    • In this case the field identifier and the value can be easily set by the command line

  • Writing a more complex set of metadata values, e.g. values more than 1 field or writing to fields taking an array of values or having a structured value.

    • In this case setting field identifiers and values with the command line is too complex and the to-be-written metadata should be defined in a JSON file.

Writing a single plain value to the Digital Source Type field

As outlined above: the value is set by an ExifTool command line.

Goal: write the value https://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia to the Digital Source Type field.

exiftool -XMP-iptcExt:digitalsourcetype=https://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia <file name>

The shown result should be:

1 image files updated

To check if this value was really embedded you can view the value:

exiftool -j -struct -G1 -n -XMP-iptcExt:digitalsourcetype <file name>

[{
  "SourceFile": "<file name>",
  "XMP-iptcExt:digitalsourcetype": "https://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia",
}]

Writing any more complex set of metadata values

As outlined above:
- Step 1: the to-be-written metadata is defined in a JSON file
- Step 2: the data from this file are embedded by ExifTool.

Create the JSON file

Solution for experts

Build a JSON file from scratch with the ExifTool identifers of the to-be-set fields as JSON property names and the values as JSON property value. Add this JSON property: "SourceFile": "*". (Look at the output of Viewing…​ use cases above as starting point.)

Generic solution

  1. Download the latest IPTC Reference Image from the IPTC Photo Metadata Standard landing page

  2. Read its metadata to a JSON file:
    exiftool -j -struct -G1 -n IPTC-PhotometadataRef-Std<version>.jpg -w -out.json

  3. Edit a copy of the IPTC-PhotometadataRef-Std<version>.jpg-out.json file:

    • Identify the fields which should be embedded …​

    • …​ and remove all other fields.

    • Set your values to the to-be-embedded fields:

      • If multiple values are used set a comma as separator. Don’t forget to check if []-brackets are enclosing the sequence of values.

      • If the field has a structure, identify which sub-fields should be set and remove the other sub-fields.

  4. How to delete possibly existing fields:

    • Add the -f parameter to the command line (see below)

    • Set the value of a field to "-"

  5. Set this JSON property properly: "SourceFile": "*"

  6. Save the edited JSON file and copy it to the same folder/directory of the image file.

Write the JSON data to the image file

exiftool -v -j=<JSON data file name>.json -n <image file name>

In this case the original image file is copied to a file with the original file name plus an appended "_original", after this copying the metadata is embeded into the file with the original file name.

OR

exiftool -v -j=<JSON data file name>.json -n -overwrite_original <image file name>

In this case the original file is NOT copied and the metadata is embedded into this file.

In any case the shown result should be:

1 image files updated

Generic ExifTool parameters

IPTC recommends using this basic set of ExifTool parameters for writing complex metadata to an image file:

exiftool -v -j=<JSON data file name>.json -n …​..

These parameters are used:

  • -j=<JSON data file name> = use a JSON file for the input of the to-be-embedded metadata.

  • -n = use the short identifiers of ExifTool’s simplified vocabulary values and not the free-text name of the controlled vocabulary value

  • OPTIONAL -v: verbose feedback while embedding the metadata.

Example images

IPTC provides a few images with embedded metadata as examples. Further the JSON files for embedding metadata and the results from reading metadata with Exiftool are available.

Example 1

An image with a fountain in a park. It has values for all fields of the IPTC-Photo-Metadata-Standard version 2023.2 embedded.

The image file

The JSON file with all to-be-embedded IPTC fields handed over to ExifTool for embedding.

The JSON file with all metadata read from the image file, including the IPTC Photo Metadata fields, also Êxif Tags and a few from other standards. Embedding and reading of metadata was done by ExifTool.

References

Name Source

ExifTool software

See https://exiftool.org - from there the latest and earlier versions of this tool can be downloaded

IPTC Photo Metadata Standard

Standard for administrative, descriptive, and copyright information about images created and published by IPTC: overview at https://iptc.org/standards/photo-metadata/iptc-standard/, specifications at https://iptc.org/std/photometadata/specification/IPTC-PhotoMetadata

IPTC Photo Metadata Standard User Guide

The guide for a proper use of the IPTC Photo Metadata Standard - see https://www.iptc.org/std/photometadata/documentation/userguide/

ExifTool command line User Guide history

(Latest entry at the top of the list)

June 2024
  • Work on a draft started