Changing IPTC copyright data with ExifTool

How to use the free ExifTool command line tool to change IPTC metadata in images on the example of copyright-related data.

I developed a feature to show IPTC copyright information automatically next to the image embedded on a WordPress website. While testing, I had to create and change some IPTC information on these images.

As a macOS user who is not a professional photographer, I didn’t have a tool at hand that could manipulate IPTC data, so I was looking for one.

I ended up using the free command-line tool ExifTool by Phil Harvey.

While it is well documented on their homepage, I wanted to keep track of the most important commands for my use cases around copyright information. Hence, this blog post.

By the way, ExifTool is available for macOS and Windows.

An image with a copyright caption.
Image Source Control takes care of displaying image author information in WordPress.

Install ExifTool

To kick things off, I installed ExifTool on my MacBook. The simplest method is via Homebrew, a package manager already installed on my system. Open Terminal and enter:

brew install exiftool

Alternatively, download ExifTool directly from the official ExifTool website for other installation options.

Viewing IPTC Metadata

With ExifTool installed, I can view image metadata in the terminal. I first navigate to the image’s directory.

Remember to replace myimage.jpg with your file’s name.

To see all image metadata, I execute the following:

exiftool myimage.jpgCode language: Bash (bash)

To see only IPTC metadata, I execute

exiftool -IPTC:All myimage.jpgCode language: Bash (bash)

Or I only look at specific metadata like this:

exiftool -IPTC:CopyrightNotice myimage.jpgCode language: Bash (bash)

Why do I check IPTC metadata with ExifTool?

I mainly check the metadata using macOS’s own Preview app. I only have to open the image in it and go to Tools > Information or hit + I on my keyboard.

Then I also upload the image into WordPress to check if it reads the metadata since that is my actual use case.

However, some of the labels in Preview or WordPress differ from those used in the IPTC metadata, so it helps me double-check them in ExifTool.

I also noticed the same information shows in different places in Preview, like in the “TIFF” and” IPTC” tabs. Looking at the metadata in ExifTool helps me to see how they are actually stored.

Editing IPTC Metadata

The reason I installed ExifTool was to edit metadata. So let’s get into that.

Here are the key IPTC tags, most of them for my purpose of adding copyright and credit information for IPTC.

Copyright:

  exiftool -IPTC:CopyrightNotice="My Copyright Notice" myimage.jpgCode language: Bash (bash)

Credit Line:

  exiftool -IPTC:Credit="Credit Information" myimage.jpgCode language: Bash (bash)

Caption:

  exiftool -IPTC:Caption-Abstract="Your Caption" myimage.jpgCode language: Bash (bash)

By-line (Creator):

  exiftool -IPTC:By-line="Creator’s Name" myimage.jpgCode language: Bash (bash)

Headline:

  exiftool -IPTC:Headline="Your Headline" myimage.jpgCode language: Bash (bash)

Explore more tags at Exiftool IPTC Tag Names.

You can also learn more about their meaning from the IPTC Photo Metadata Standard.

General Tags

I first tried to use some general tags, like

exiftool -copyright="Thomas" myimage.jpgCode language: Bash (bash)

While this did indeed create a “Copyright” image metadata entry, it didn’t show in Preview or WordPress.

Using the following created the actually used copyright information in IPTC.

exiftool -copyrightnotice="Thomas" myimage.jpgCode language: Bash (bash)

credit is another essential copyright-related information.

exiftool -credit="Thomas" myimage.jpgCode language: Bash (bash)

Deleting IPTC Metadata

When playing around with the tags, I created a lot of unneeded IPTC and image image meta. To clean all IPTC metadata up, I used

exiftool -IPTC:All= myimage.jpgCode language: Bash (bash)

You can also use this pattern with any other examples from this post.

ExifTool keeps the original

When ExitfTool makes a change, it creates a copy of your file by adding _original to the extension.

So, the original version of myimage.jpg is stored as myimage.jpg_original.

This annoyed me a bit since, with the changed extension, I could no longer open the file with any program on my Mac without changing the file name. You can add -overwrite_original to the command to prevent that file from being created.

exiftool -IPTC:All= -overwrite_original myimage.jpgCode language: Bash (bash)

Verifying IPTC Metadata Changes

Post-editing, I quickly confirm my changes. To check a specific tag, I use:

exiftool -IPTC:CopyrightNotice myimage.jpgCode language: Bash (bash)

This command verifies the applied changes.

Troubleshooting

Correct file path

Encountering a “File not found” error typically indicates incorrect file paths or names. I prefer to navigate to the image folder in Terminal before I execute any ExifTool command, but one could also use the full path of an image in another folder.

Use the correct tags

When I started experimenting with this, I thought that the correct record tag for the copyright was using

exiftool -IPTC:copyrightCode language: Bash (bash)

though I learned that it should be

<code>exiftool -IPTC:CopyrightNotice</code>Code language: Bash (bash)

Some googling helped, and I eventually found the ExifTool ApplicationRecord Tags on their official website.

Conclusion

I found Exiftool to be an indispensable tool for handling IPTC metadata on macOS.

This overview will hopefully help me return to the commands most relevant in my work with Image Source Control.

FAQ

Some answers to questions people sent me about this post.

How do I overwrite specific IPTC fields in all images within a folder, including images in its subfolders?

To overwrite specific IPTC fields in all images within a folder and its subfolders, use the following ExifTool command:
exiftool -r -IPTC:FieldName="New Value" /path/to/directory
-r: Operates recursively through the directory and subfolders.
FieldName: The name of the IPTC field you want to change.
New Value: The value you want to set for this field.
/path/to/directory: The path to your main folder.
Always back up your data before running recursive commands.

Can I change multiple IPTC metadata fields in a single command?

Yes, multiple IPTC fields can be changed in one command. Here’s how:
exiftool -r -IPTC:FieldName1="New Value1" -IPTC:FieldName2="New Value2" /path/to/directory
Each -IPTC:FieldName="New Value" represents a field to be changed.
Add as many field assignments as needed, separated by spaces.

Portrait of Thomas Maier, founder and CEO of Image Source Control

Questions? Feedback? How can I help?

Reach out directly via the contact form.