How often are you faced with a regular metadata manipulation that your favourite image processing application just does not offer? Think of filling in your copyright data in one go, correcting your camera’s time settings for a number of images or setting your home geotags.
ExifTool is the Swiss army knife of metadata modifications, reliable and versatile, supporting all possible formats and standards. But the downturn is that it is a Perl library that offers only command line comfort, and not everybody is a programmer. There is a Windows-based GUI, but there is also the possibility to integrate the library with Apple’s Automator that ships with MacOS since 10.4.
I will show you a few actions that I use quite regularly because they are much faster or offer possibilities that my image processing and geotagging apps do not have. Note that those actions will work on most image types that support EXIF and IPTC tags. Please refer to Phil Harvey’s site for details.
ExifTool operations are lossless: they modify the metadata, not the image quality.
But first, let us gear up our Mac with the ExifTool. Installation is simple: download the DMG package from Phil’s website and run the installer. Remember, it is a command line tool, so it will not put a program icon in your applications folder.
Now launch the Automator which sits in the root directory of your applications folder (“Automator.app”).
From the welcome screen select “Photos & Images”, the future default location of the image files (“Get content from”) and the kind of interaction you would like to see. I chose “Ask for image files when my workflow runs” as it gives you a lot of flexibility.
The “Ask for Finder Items” action now appears in the column to the right. You may configure it to your needs – I recommend to change the options to “Files and Folders” and “Allow Multiple Selections”.
This is the general starting point for the actions described below.
Write EXIF Creation Date Into IPTC
For our first ExifTool action we assume that we want to transfer the EXIF creation date into the IPTC creation date header. (This is just an example for how to build a workflow – for more specific timestamp modifications please refer to my post “Timestamps and Timezones“.)
Add “Run Shell Script” from the action template column in the middle and drag it to the right, just below our first entry. Make sure to set “pass input” to “as arguments”.
In the text box enter the following script:
for f in "$@" do exiftool -overwrite_original '-IPTC:DateCreated<EXIF:CreateDate' "$f" done
(Be careful when copying and pasting this code to remove any line breaks that may occur in the exiftool statement! There should be only the one before the “done” line. Note that Macs require single quotes in the parameters. For further explanation of ExifTool parameters, please refer to Phil’s website.)
This is all you need to complete the Automator action. However, if you have Growl installed, you can set Automator up to notify you when the job is done.
Now all that is left is saving the Automator action. I suggest saving it as an application:
You can run the action just like any other application. At first, it will ask you for the source destination of your image files. Please note that the script will overwrite the source files at the location! Make sure that your first run is on copies rather than your valuable originals.
When you click the “Choose” button the action will set the IPTC creation date of the selected files (or all files in the selected folders) to its EXIF value. Once it has finished, the Growl notification will appear.
Write Lens Make And Aperture
I sometimes like to do a field trip using my Lensbaby Composer lens. The fascination of this accessory lies in its simplicity and the negation of the “exact” reproduction ideal other lenses pursue. Lensbaby aperture is created by a flat metal ring that you place into the lens with a magnetic pin – it is really a very basic construction.
The simple mechanical construction leaves no footprint in the camera-generated EXIF data. Neither make nor focal length or aperture will show up. So, in order to recall which settings I used, I wrote another ExifTool-based Automator action:
for f in "$@" do exiftool -overwrite_original -Lens='Lensbaby Composer 50mm F2-22' -ApertureValue='4' -FocalLength='50' "$f" done
(If you want to use this code in your own action, do not forget to remove the line breaks from the exiftool statement!)
This sets the lens make to “Lensbaby Composer 50mm F2-22″, the focal lenght to 50mm and the aperture value to F4.
At the beginning of the Automator workflow, I added a dialog box action (“Ask for Confirmation”) which announces what is about to happen. This is quite helpful when you use a number of scripts regularly.
After running the action on my images, the EXIF tab reveals that they are now correctly marked.
Write Recurring Geotags
Writing geotags into your travel images is usually a task for a geotagging application: using a GPS logfile or a dynamic map, you may set the location coordinates for individual shots.
However, you may often shoot images at the same location (e.g. an available light session from your tripod, press pictures from town hall, snapshots of your kids at home etc.). Then, inserting coordinates individually is not really worth the hassle. It is much more convenient to have an Automator app for each recurring location.
A simple ExifTool statement can make your life easier:
for f in "$@" do exiftool -overwrite_original -n -GPSLatitude='38.89767132073924' -GPSLatitudeRef='N' -GPSLongitude='-77.03655123710632' -GPSLongitudeRef='W' -GPSAltitude='20' -GPSAltitudeRef='0' "$f" done
(Do not forget to remove the line breaks from the exiftool statement!)
Replace the coordinates with your shooting location (unless it actually was the White House). Do not forget to indicate the N/S and W/E reference values or you might end up on the wrong hemisphere. The altitude reference should remain 0, unless you have an underwater base that you frequent for your shootings. If you are uncertain about those values, look them up at my SMC Live Map.
Write Copyright Information
If your image processing application does not support inserting your full credentials automatically, you may use the following ExifTool statement:
for f in "$@" do exiftool -Artist='John Doe' -Copyright='(c) John Doe 2009, all rights reserved' -By-line='John Doe' -By-lineTitle='Freelance Photographer' -Credit='John Doe Photography' -Source='The Big Photography Network' -Contact='John Doe, email@example.com' "$f" done
(Do not forget to remove the line breaks from the exiftool statement! Have I mentioned this before?)
Adjust EXIF Time Settings
If the camera’s clock is not set correctly you may want to adjust the time stamp it left in the EXIF header. Here is an example how you can do this using the ExifTool:
for f in "$@" do exiftool '-DateTimeOriginal+=0:25:0' "$f" done
This statement adds 25 minutes to the “created” time stamp in the EXIF header of the image.
A good explanation of time modifications can be found on Phil’s website.
If you want to find out about all of the metadata information stored inside your image, you may let ExifTool create a text file with this information that is stored alongside the image:
for f in "$@" do exiftool -n -g1 -w %d%f_tags.txt "$f" done
- Download site for Automator actions at Apple.com
- March 18th, 2009: added “Reading All Metadata” section and slightly modified ExifTool statements for increased performance
- March 24th, 2009: modified statements with single quotes; added lossless modifications hint and reference to “Timestamps and Timezones” post and SMC Live Map