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.
Put the power of Phil Harvey’s excellent ExifTool and Apple’s Automator together and you will have replaced many previously tedious tasks with a simple action.
Metadata Manipulator
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.
Setup
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”.

The Automator window consists of two areas: to the left, there are the available action templates. The right column contains the individual action steps we are currently working on.
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.

Run the Automator action like any other application. A dialog window will ask you for the location of your image files.
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.

This Automator action inserts Lensbaby Composer's make, focal length and aperture into the file's EXIF header.
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, john@doe-photography.com' "$f"
done
(Do not forget to remove the line breaks from the exiftool statement! Have I mentioned this before?)
Please refer to Phil’s website, the Associated Press’s code page or the IPTC Photo Metadata site for more details.
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.
Reading All Metadata
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
Further Reference
- Download site for Automator actions at Apple.com
Updates
- 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
Tags: Automator, ExifTool, Geotagging, Mac, Metadata, Software








This is very interesting info just what I need especially as I have just got a lensbaby Thank you
One question if you don’t mind its a bit of a dumb one sorry
Where can I get a pop up window like yours showing more info
Thanks again
Graham
Hi Graham,
in Preview, just press Cmd+i while an image is open or use the menu (under “tools” you will find the “show information” entry).
Hope that answers your question.
Klaus
Hi,
You have done a fantastic tool, I no nothing about scripting, but your example is exactly what I was looking for, I’m a photograph, and I use a lot of manuals lenses, and I was looking for a loooooong time your trick of the “Write Lens Make And Aperture”
Will it be possible to add a dialog box with text input fields like this :
Lens : ………
Focal length : ………
Aperture : ……….
and then the program write in the EXIF the value entered before !
like this, you don’t have to create a Automator droplet for each combinaison of Lens/Aperture used
can you tell me how to add such feature in the automator script ?
Thank you very much for your work
Best regards
Laurent
Hi Laurent,
thank you for your comment. Unfortunately, I do not know enough about Apple Script to help you out. As a matter of fact, I would be glad if someone came up with a solution to this, as it would be quite useful for most of the other ExifTool operations described in my blog (e.g. to set timezones).
Any contributions are greatly appreciated!
Klaus
Hi,
well after looking a bit, I found a great way, not perfect, but here it is :
After loading the file, ask Automator to do an Applescript script :
on run {input, parameters}
set r to text returned of (display dialog “Lens parameter :” default answer “{\”Lens\”,\”Focal\”,\”Aperture\”}”)
set r to run script r
return r & input
end run
Than the Shell script :
var1=”$1″
var2=”$2″
var3=”$3″
shift 3
for f in “$@”
do
exiftool -overwrite_original -Lens=”$var1″ -FocalLength=”$var2″ -ApertureValue=”$var3″ -FNumber=”$var3″ “$f”
done
That’s all
Great no !!
Hi
You have a nice walkthrough here, though I keep finding myself stuck. I’m trying to add the lens type, and have done what you were doing with the lensbaby, but simply missing the focal length and aperture parts out. In the run script shell itself I’m using:
for f in “$@”
do
exiftool -overwrite_original -Lens=’70.0-300.0 mm f/4.5-5.6′ “$f”
done
The automator runs fine, but there is no change in the EXIF data. Is it blindly obvious what I’ve done wrong?
Any help would be brilliant!
Seb
Please ignore the previous comment, embarrassingly I had failed to change the pass input to ‘as argument’. A ‘nice’ guide has become a ‘wonderful’ guide :D.
Many thanks!
[...] wyżej napisał – jakiś EXIF-Tool + Automator. Poczytaj, może znajdziesz jakieś ciekawe info ExifTool and the Automator | studio.messlinger.com Komputer: MacBook Pro 15.4-inch 2,4 GHz Telefon: iPhone 3G 8GB -> Kanał [...]
Hi all,
I would like to extract and create XMP files from DNG using Automator and exiftool. I have never used either tool so I am a totally new to this. I have found on the exiftool site some command lines that I think should work but I don’t know enough to string it all together. http://www.sno.phy.queensu.ca/~phil/exiftool/metafiles.html
Does anyone have any suggestions?
Thanks,
Alison
Hi Alison,
you have hit the right page with that link: you’ll find the commands you’ll need there.
Follow the instructions above for setting up ExifTool and how to create Automator actions and then insert the command line from Phil’s documentation like this:
for f in "$@"do
<YOUR COMMAND LINE GOES HERE> "$f"
done
That’s all, really. Try to run your actions on copies of your images first, to avoid accidentally erasing metadata.
If you want to run more than one command on your files, you may either create another Automator action or add the line into the above statement like this:
for f in "$@"do
<YOUR COMMAND LINE GOES HERE> "$f"
<YOUR 2ND COMMAND LINE GOES HERE> "$f"
<YOUR 3RD COMMAND LINE GOES HERE> "$f"
done
Have fun,
Klaus
Hi Klaus, I must be doing something wrong as I have, within the examples you have given above, tried almost all the commands from that one web page and I don’t get any .xmp sidecar files. I have even tried your Read All Metadata above to get a text file and I get zippo. What I’m doing:
1. Copied all adjusted DNG files to a folder on my desk top.
2. Running Automator 2.0.4, OS X 10.5.8.
3. Ask for Finder Items, start at: Folder On Desktop, Type: files, Yes allow Multiple.
4. Run Shell Script, Shell: /bin/bash, Pass input: to stdin
for f in “$@”
do
exiftool -n -g1 -w %d%f_tags.txt “$f”
done
When I run it I get the chime its done and not error. But I get no text file in the folder where I have the DNG files.
I’m sure there is something really simple I’m missing.
Thanks for the help.
Alison
Hi Alison,
I guess I made a mistake in my documentary screenshots (part of them was documentation-only and not taken from the productive scripts I am using):
Please change “Pass input” from “to stdin” to “as arguments”.
Sorry for the troubles this has caused.
Klaus
Hi Klaus,
No worries. This change did the trick. This is going to save me a ton of time going forward. Thanks so very much for posting this info and helping me with my little problem.
Best regards,
Alison
http://www.panoramio.com/user/823582
http://gallery.me.com/rdsck
Just coming back from a 4X4 expedition in Bolivia. I noticed that my photos were positioned on the wrong place in Google. Then , in Panoramio forum, I heard that this is a well know Panoramio “mistake”.
I found your site, and for the first time of my life, I opened Automator :-)))
Many thanks for your time, great work ( and compassion ! )
Kind regards from North Chile richard
This looks very promising. I have spent the better part of last night trying to create an action that will replace lost exif data in CS5 tampered files with the original exif data from the corresponding nef. I have all the arguments that I need to input (everything works if entered directly in the command line in the Terminal. The problem I have with the automator is that I need to input SourceDirectory “in the middle of the script” as well as TargetDirectory at the end of the script, i.e. I have .. fixed syntax + “INPUT1″ + fixed syntax + “INPUT2″. Is this possible, i.e. how do I get the script to read, ask for and accept INPUT1, read, ask for and accept INPUT2 and the execute?
Regards
Hans
I eventually got it right. Works like charm!
//Hans
Hi Hans,
thanks for your contribution. Maybe you can share the solution you found?
Thanks,
Klaus
Hi,
Of course I can and if you like I can upload or send you the automator scripts so that they can be used and/or tweaked by you or others. I have three different scripts, one for replacing exif data in files in the same directory, two for replacing exif data where the source and target files are in different directories. I guess that the two latter could be combined into one but I haven’t yet tried that. The syntax in the same and different directory scripts are somewhat different.
I tried to take a screenshoot and paste into this message but failed so I will try to give a step by step instruction.
Drag two “Ask for Finder items” to the right hand side of the Automator dock
I choose to have the program start at Desktop (but I guess the starting point can be whatever you like), set the type to folders and thick the box Allow Multiple Selection.
Drag “run Shell Script” to the right hand side of the Automator dock.
Set pass input As arguments and then have the “display” in the Shell Sscript text box read as follows:
for f in “$@”
do
exiftool -tagsfromfile “$1″/%8f.nef -exif:all -ext tif “$2″
done
As a last item I dragged “Show Growl Notification” to the right hand side of the Automator dock.
The syntax %8f means that files are picked based on the eight first characters and this might come in handy if edited files have been named with additional info such as “edited”. If you omit the “8″ the filenames need to match (except for the extension). What made me struggle with the Automator was that it took several hours before I realized that I had to put in numbers (1 and 2) instead of “f” in order to have the user input information passed to right place but I guess this is what happens when you have no real idea on what you are doing.
I have also tried to make a script that deletes the resulting “original” but have not yet succeeded. The problem I have is that when the script has run you need to confirm deletion and I haven’t found a way to have this included.
Regards
Hans
I’ve downloaded and began playing with exiftool on my Mac, via the Automator. I suspect what I am trying to do is possible, but I am failing! (perhaps it’s impossible!) What I am trying to do is: Extract the file name, date stamp, and time stamp from each video in a folder of AVI files, and drop these into an excel spreadsheet, with each row of the spreadsheet being the data extracted from each file.
I am working with Wildlife camera-trap images and video files, and part of the data-gathering exercise is to know when (date and time) an animal was photographed – so I am working with 1000s of files each month, and currently have to manually enter date and time for each image into the excel spreadsheet.
Any help greatly appreciated!!
Hi Karl,
it is probably best if you post your question right at the source: Phil Harvey’s ExifTool forum.
If you search for “avi” you will already find lots of useful information. And Phil puts a lot of effort into answering new questions personally, so don’t be afraid to ask.
Best regards,
Klaus
PS: You will find the available options and commands in Phil’s Application Documentation.
Thanks Klaus!
Hi Klaus,
Excellent posting! Thanks a lot!
ExifTool is a great tool but indeed unfortunately doesn’t come with a GUI for us Maccers.
I’ve made a Folder Action using AppleScript in the past to have a folder on my Desktop on which I can drag&drop images e.g. from a browser window that will then instantly show a complete listing of the EXIF info. There are of course various browser plugins that do more or less the same, but none of these provide the depth of information that ExifTool provides (such as lens used).
The AppleScript can be found here:
http://www.onemorething.nl/community/topic/exiftool-applescript
(Explanation is in Dutch…)
Regards,
Pieter.
[...] # of fingers each time I switch to a different lens). Here is the link to get you started with an overview of what Exiftool and Automator can do. And here is the link to a script written by user "Fokalfissur" on the L-Camera Forum that puts it [...]
I had a question. If i wanted to specify the ‘Date Created’ date how would I alter the code below for me to input the date I want to be written to the file?
for f in “$@”
do
exiftool -overwrite_original ‘-IPTC:DateCreated<EXIF:CreateDate' "$f"
done
Hello Anthony,
just refer to Phil Harvey’s detailled manual for all sorts of examples.
Klaus
Hey how are you?!
First thank you for this post it was very easy to follow for a non code oriented person like me.
I’m a photographer and I use a Rokinon 8mm lens (a manual lens) for my panoramic work and I need to add the f/ stop value and focal length and lens brand just like you did in your example, I’ve used your script and just changed the values there, but I get the “focal length wright”, but not the aperture value or the f/ stop, instead I get wrong values.
I want to set f/8 “aperture”, Rokinon 8mm lens “name of the lens” and 0.5 as “focusing distance”.
Example I’ve used:
for f in “$@”
do
exiftool -overwrite_original -Lens=’Rokinon Fisheye 8mm F3.5-22′ -ApertureValue=’8′ -FocalLength=’0.5′ “$f”
done
What I’m doing wrong, notice that the script do it’s work without errors and I have the Phill’s EXIF tool installed without problems, but when read the Exif in Preview, the name of the lens is ok, ApertureValue is ok, FocalLength is ok, but where it say FNumber is 0.
Thank you.
Nuurs
Hello Nuurs,
your script should be slightly adapted:
for f in “$@”
do
exiftool -overwrite_original -Lens=’Rokinon Fisheye 8mm F3.5-22′ -ApertureValue=’8′ -FNumber=’8′ -FocalLength=’8′ -SubjectDistance=’50/100′ “$f”
done
“ApertureValue” and “FNumber” are both indicating your aperture (f-stop). Setting both values may increase your chances to correctly read them in your favourite imaging app.
“FocalLength” is your focal length, i.e. 8mm. It is not the focusing distance!
You will have to add the “SubjectDistance” tag in order to write your focusing distance. The value is given in meters and entered as a fraction (numerator and denominator). In the example above, the distance would be 0.5 m.
Hope this was helpful for you!
Klaus
Thank you! I played around with automator a couple of times in the past but your post here has now made it clear how to use it. I found exiftool thanks to graphicconverter and was very sorry there was no gui for it. This post has made it possible for me to use it and is almost as good as a gui. I had thousands of pictures I had edited, moved, copied, renamed, etc. and had so many duplicates I couldn’t count them. I also had lost the exif data on many and many were scans of old photos. Because of the way iphoto organizes, I really wanted to get valid dates into exif on all the pics and to get rid of all the duplicates and get back to the originals on the ones that had them. I also discovered photos with dates off because the camera dates weren’t set. I had been working on this project for 3 or 4 weeks (and probably making maters worse) before I found your post. Just wanted to say thank you again.
For anyone else who may need to separate files with exif data from those without here is a quick way to do it
for f in “$@”
do
exiftool ‘-Directory<DateTimeOriginal' -d Has_Exif "$f"
done
All the files with exif date will be moved to directory Has_Exif and those with out will stay where they were. (you may have to look for the directory. For some reason mine always ends up back in my user directory rather than as sub from where I started. )
Now I can use graphic converter to find all the dups and not worry about deleting the copy with the exif data by mistake.
Hello
I am using the Apple automator workflow for Export EXIF data from Aperture. Unfortunately it doesn’t seem to export Lens Model info, everything else I need is there. I’ve admired your advice above and hoped perhaps you’d have some advice on how to add this important and missing piece of info for me?
Thank you!
Hello GayanB,
if you use the statement
exiftool -n -g1 -w %d%f_tags.txt “$f”
as described above under “Reading All Metadata”, the lens model gets exported, too.
However, the information that is exported depends on the metadata category (Exif, IPTC, XMP, Canon etc.). For one of my shots I find in the EXIF section only:
Lens Info : 24 105 undef undef
In the Canon section, the entry is more specific:
Lens Model : EF24-105mm f/4L IS USM
If you want do dig deeper in the possibilities of exporting certain details of metadata, I suggest you look into the ExifTool examples page:
http://owl.phy.queensu.ca/~phil/exiftool/exiftool_pod.html
Best,
Klaus