The tool that IPTC recommends the most for command-line use is Phil Harvey’s ExifTool (exiftool.org).
How you install the ExifTool software depends on your operating system and environment. Here are some installation instructions.
It has extensive documentation online. You can also run exiftool
with no arguments for a complete list of available options with examples.
On this page:
To get you started quickly, here are some examples of things that can be done with exiftool
regarding IPTC metadata (we cover writing these fields below)
Simply run exiftool
with the file name / path to the image file that you wish to investigate:
exiftool <image file name> |
This will simply display all metadata (IPTC, Exif and other formats) that can be extracted from the file.
ExifTool can extract any single property from a media file. To find out which tag to use, first consult the IPTC Photo Metadata Standard Specification to get the XMP tag used, then consult the exiftool XMP tags page to determine how to specify that tag for exiftool.
% exiftool -XMP-iptcExt:digitalsourcetype IPTC-PhotometadataRef-Std2021.1.jpg Digital Source Type : http://cv.iptc.org/newscodes/digitalsourcetype/softwareImage |
% exiftool -XMP-photoshop:Credit IPTC-PhotometadataRef-Std2021.1.jpg Credit : Credit Line (ref2021.1) |
Here’s an example of viewing a non-structured but multi-valued property:
By default, exiftool shows multi-valued properties as comma-separated values on the same line:
% exiftool -XMP-dc:creator test-image.jpg Creator : Creator 1, Creator 2 |
Using the -struct option shows more clearly that it is in fact a list of values:
% exiftool -struct -XMP-dc:creator test-image.jpg Creator : [Creator 1,Creator 2] |
To make it totally clear that it is in fact a repeatable value, you can ask for JSON-encoded output:
% exiftool -json -XMP-dc:creator test-image.jpg [{ "SourceFile": "test-image.jpg", "Creator": ["Creator 1","Creator 2"] }] |
And to ensure that the returned field names match those given in the input (e.g. “XMP-dc:creator” rather than just “Creator”), use the -G1 flag:
% exiftool -G1 -json -XMP-dc:creator test-image.jpg [{ "SourceFile": "test-image.jpg", "XMP-dc:Creator": ["Creator 1","Creator 2"] }] |
Some properties (such as Licensor which is used for Google’s Licensable feature) are structured, which means they contain sub-properties. In this case, running the simple exiftool -XMP-plus:Licensor test-image.jpg
returns no results.
The secret is to use the -struct
option:
% exiftool -G1 -json -struct -XMP-plus:Licensor test-image.jpg [{ "SourceFile": "test-image.jpg", "XMP-plus:Licensor": [{ "LicensorCity": "Licensor City 1 (ref2021.1)", "LicensorCountry": "Licensor Country 1 (ref2021.1)", "LicensorEmail": "Licensor Email 1 (ref2021.1)", "LicensorExtendedAddress": "Licensor Ext Addr 1 (ref2021.1)", "LicensorID": "Licensor ID 1 (ref2021.1)", "LicensorName": "Licensor Name 1 (ref2021.1)", "LicensorPostalCode": "Licensor Postcode 1 (ref2021.1)", "LicensorRegion": "Licensor Region 1 (ref2021.1)", "LicensorStreetAddress": "Licensor Street Addr 1 (ref2021.1)", "LicensorTelephone1": "Licensor Phone1 1 (ref2021.1)", "LicensorTelephone2": "Licensor Phone2 1 (ref2021.1)", "LicensorTelephoneType1": "Work", "LicensorTelephoneType2": "Cell", "LicensorURL": "http://www.newlicensorurl.com/" },{ "LicensorCity": "Licensor City 2 (ref2021.1)", "LicensorCountry": "Licensor Country 2 (ref2021.1)", "LicensorEmail": "Licensor Email 2 (ref2021.1)", "LicensorExtendedAddress": "Licensor Ext Addr 2 (ref2021.1)", "LicensorID": "Licensor ID 2 (ref2021.1)", "LicensorName": "Licensor Name 2 (ref2021.1)", "LicensorPostalCode": "Licensor Postcode 2 (ref2021.1)", "LicensorRegion": "Licensor Region 2 (ref2021.1)", "LicensorStreetAddress": "Licensor Street Addr 2 (ref2021.1)", "LicensorTelephone1": "Licensor Phone1 2 (ref2021.1)", "LicensorTelephone2": "Licensor Phone2 2 (ref2021.1)", "LicensorTelephoneType1": "Work", "LicensorTelephoneType2": "Cell" }] }] |
To read more than one property from a file, simply specify multiple ExifTool tags, each prefixed with a dash/hyphen character.
% exiftool -G1 -XMP-dc:creator -XMP-photoshop:Credit -XMP-dc:rights -XMP-xmpRights:WebStatement -XMP-plus:LicensorURL IPTC-GoogleImgSrcPmd_testimg01.jpg [XMP-dc] Creator : Jane Photosty [XMP-photoshop] Credit : IPTC/Jane Photosty [XMP-dc] Rights : © Copyright 2020 IPTC (Test Images) - www.iptc.org [XMP-xmpRights] Web Statement : https://iptc.org/tests/copyright-and-licenses-of-images-test-page/ [XMP-plus] Licensor URL : https://iptc.org/tests/licensing-of-images-test-page/ |
% exiftool -G1 -XMP-dc:creator -XMP-photoshop:Credit -XMP-dc:rights -XMP-xmpRights:WebStatement -XMP-plus:LicensorURL -XMP-iptcExt:DigitalSourceType test-image.jpg [XMP-dc] Creator : New Creator, Additional Creator, Additional Creator [XMP-photoshop] Credit : New Credit Line [XMP-dc] Rights : New Rights line [XMP-xmpRights] Web Statement : New Web Statement of Rights [XMP-plus] Licensor URL : http://www.newlicensorurl.com/ [XMP-iptcExt] Digital Source Type : https://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia |
This displays the internal structure of the XMP packet that is stored within an image file. This is usually only needed for debugging purposes or if you are curious about how XMP metadata is actually stored inside the file.
$ exiftool -b -xmp IPTC-PhotometadataRef-Std2021.1.jpg <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?> <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.34'> <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'>This is the Alt Text description to support accessibility in 2021.1</rdf:li> </rdf:Alt> </Iptc4xmpCore:AltTextAccessibility> <Iptc4xmpCore:CountryCode>R21</Iptc4xmpCore:CountryCode> [... much more data snipped for brevity ...] </xmpRights:UsageTerms> <xmpRights:WebStatement>http://www.WebStatementOfRights.org/2021.1</xmpRights:WebStatement> </rdf:Description> </rdf:RDF> </x:xmpmeta> |
The same ExifTool XMP tags can be used to write metadata to image files on the command line.
Note that by default when writing to an image file using |
Note that the value can be any text string, but we recommend using a full URI from the IPTC Digital Source Type vocabulary:
% exiftool -XMP-iptcExt:digitalsourcetype=https://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia test-image.jpg 1 image files updated |
(Note that Google’s documentation on Digital Source Type for synthetic media specifies using only the ID, not the full URI. So if you are writing software to read these values, we recommend that you support both the fully-expanded URI and the short ID.)
The contents of these fields will be displayed in the Google Images search results details panel.
% exiftool -XMP-dc:creator="Jane Smith" -XMP-photoshop:Credit="Jane Smith, Smith Photography Ltd" -XMP-dc:rights="Copyright Smith Photography Ltd 2023" -XMP-xmpRights:WebStatement="http://smithphotography.com/licensing/" -XMP-plus:LicensorURL="http://www.mypictureagency.com/obtain-licence/" -XMP-iptcExt:DigitalSourceType="https://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture" test-image.jpg 1 image files updated brendan@Brendans-M1-MacBook-Pro pmd-sample-images % exiftool -XMP-dc:creator -XMP-photoshop:Credit -XMP-dc:rights -XMP-xmpRights:WebStatement -XMP-plus:LicensorURL -XMP-iptcExt:DigitalSourceType test-image.jpg Creator : Jane Smith Credit : Jane Smith, Smith Photography Ltd Rights : Copyright Smith Photography Ltd 2023 Web Statement : http://smithphotography.com/licensing/ Licensor URL : http://www.mypictureagency.com/obtain-licence/ Digital Source Type : https://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture |
This triggers the “Get this image on…” text in Google Images search results.
% exiftool -XMP-plus:LicensorURL=http://www.mypictureagency.com/obtain-licence/ test-image.jpg 1 image files updated |
Note that this approach will not work if there are already two or more Licensor records in the image metadata. This is because the exiftool argument -XMP-plus:LicensorURL
is a shortcut for “the LicensorURL sub-property in the first Licensor structure in the image.” But for most images, there will be only one licensor record or more likely no records at all, so this shortcut will work.
If you need to edit the LicensorURL of an image with two or more Licensor records, you should use the
This triggers the “Licensable” badge in Google image search results.
% exiftool -XMP-xmpRights:WebStatement="http://smithphotography.com/licensing/" test-image.jpg 1 image files updated brendan@Brendans-M1-MacBook-Pro pmd-sample-images % exiftool -XMP-xmpRights:WebStatement test-image.jpg Web Statement : http://smithphotography.com/licensing/ |
% exiftool -XMP-dc:creator="Jane Smith" -XMP-photoshop:Credit="Jane Smith, Smith Photography Ltd" -XMP-dc:rights="Copyright Smith Photography Ltd 2023" -XMP-xmpRights:WebStatement="http://smithphotography.com/licensing/" -XMP-plus:LicensorURL="http://www.mypictureagency.com/obtain-licence/" -XMP-iptcExt:DigitalSourceType="https://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture" test-image.jpg 1 image files updated brendan@Brendans-M1-MacBook-Pro pmd-sample-images % exiftool -XMP-dc:creator -XMP-photoshop:Credit -XMP-dc:rights -XMP-xmpRights:WebStatement -XMP-plus:LicensorURL -XMP-iptcExt:DigitalSourceType test-image.jpg Creator : Jane Smith Credit : Jane Smith, Smith Photography Ltd Rights : Copyright Smith Photography Ltd 2023 Web Statement : http://smithphotography.com/licensing/ Licensor URL : http://www.mypictureagency.com/obtain-licence/ Digital Source Type : https://cv.iptc.org/newscodes/digitalsourcetype/digitalCapture |
exiftool allows appending to a repeatable list of tags, for example Image Creator (dc:creator):
% exiftool '-XMP-dc:creator+=New Creator' test-image.jpg 1 image files updated % exiftool -XMP-dc:creator test-image.jpg Creator : Creator 1, Creator 2, New Creator |
If you would like to see other exiftool examples, or if you have suggestions of exiftool incantations that you find useful and you would like to share them with others, please let us know!