Photo File Surgery: Use ExifTool and Mac Automator to Hack the Contents of Your Photo Files

If you’ve ever taken a deep look at the meta information tucked inside your photo files, you realize there is a lot more going on in a JPEG or RAW file than just pixel information.  Inside the labyrinth of code are tucked away tiny snippets of information that reveal every detail about how you took the photograph.  Everything from the orientation of your camera (did you ever wonder why you don’t have to rotate images anymore) to the temperature of the your camera is recorded for posterity.  One new innovation among camera makers and photographers is to embed GPS information within the photo file.  Although GPS information is exceedingly handy for the photographer, it can also raise privacy concerns when your photos are published to the web.

All self respecting photo editing softwares can mine meta data for you and present it for reference and modification.  Each software, however, has its own way of presenting the meta data and limitations on how you can modify it.  It can also be be confounding to determine whether data has been deleted or just hidden and whether the modifications on RAW files are passed onto JPEG export files.  This article will illustrate how to use a freeware tool known as ExifTool to gain total control over the contents of your photo files.  Exiftool is known for its ability to parse a photo file and extract every last hidden drop of meta data for reference or editing.

Unfortunately, what ExifTool boasts in power it lacks in user-friendliness.  To that end, we’ll couple its demonstration with another great Mac tool – Automator.  Automator is a Mac utility used to build your own applications and is one of the most underused utilities on the Mac.  For this exercise, we will focus on programming two utilities, a meta data viewer and a GPS data delete utility.  Once you have these utilities, you will be able to control the contents of your files directly.  You will also be able to delete/modify any sensitive information (such as embedded GPS data) before uploading to the web.  Unsure whether Aperture or Lightroom made the meta modifications you wanted?  These utilities will help you check.

Creating a Meta Data Mining Application

1.  Download and install ExifTool

  • Download the Mac OSX installation package from  (the download file should be called something like ExifTool-xxx.dmg).
  • Installation is as easy as opening the disk image and double clicking.  This will install the exiftool command line tool into your /usr/bin directory.  The exiftool command can now be invoked from any command line prompt.  Command line junkies can feel free to explore the power of exiftool at this point.  For the rest of us, we’re going to create a simpler user interface for the tool via Automator.

2.  Create Automator Actions for ease of use

  • Open Automator from your application directory.  You should see a quick start window asking you to choose a template.  Choose the workflow template.
  • At this point you should see a panel with available actions (such as “Activate Fonts”).  The workflow is built by dragging various actions to the right to design a workflow.
  • For this workflow, we’ll need four actions: Ask for Confirmation, Ask for Finder Items, Run Shell Script, and Show Growl Notification.    If Growl is not installed on your Mac, you will not see its notification action so just leave it out.  Drag each of these actions to the workflow panel on the right.
  • WIth all the actions in place, we can begin customizing them.  Within the Ask for Confirmation action, type the following text:

This application will extract all meta data from your photo file and write it to a text file called *_meta.txt

  • Within the Ask for Finder Items Action, choose the Start At folder which you want to be your default folder for selecting photos.  Under Type, select Files and Folders.  Lastly, check the box for Allow Multiple Selections.
  • Within the Run Shell Script Action, simply paste in the script below.  Ensure all characters and formatting are preserved in the pasted text.  Then choose to Pass input as arguments.
for f in "$@"
   exiftool -a -u -n -g1 -w! %d%f_meta.txt "$f"
  • Within the Show Growl Notification Action, Type a Title such as “Complete!”.  Under Description type “Text File Written”.

The finished workflow should look something like this:


  • To finish, select File -> Save As and give your application a name such as Readmeta.  Then choose a save location (such as your Desktop).  Under File Format, choose Application. Clicking Save should create an application in the location you chose.  Optionally, you can save a second version of your application in the Workflow file format so you can open and modify the contents later.
  • To test the application, find the newly created application and double click it.  This should bring up the confirmation prompt you programmed above. Click OK and you should see a finder window.  Select any photo file (or multiple photo files) and click Choose.  Note that if you highlight a folder and click choose then all the application will write text files for every photo in that folder. Once the selection is complete and assuming you programmed the Growl Action, you should see the Growl notification pop up saying “Complete!”   A text file should be written to the same folder containing the photo file.  Open the text file to see all the details of your photo.
  • Congratulations.  You’re new application is complete.  Use it to mine the details of any photo you wish.  Our next project will be create an application to modify meta information – specifically to delete all GPS information from a given photo file.

Creating a GPS Data Delete Application

This application will be very similar to the one above with only slight changes to the shell script.  Make another Automator workflow based on the screenshot below and save it as something like “”.

To test this application, first run the application on a file which you know has embedded GPS data to see how the GPS information is encoded.  Then run to delete the GPS data. Finally, run again to verify that the GPS data was surgically removed.

Final Comments

These exercises should give you an overview of  how ExifTool and Automator Actions can enhance your photo workflow.  Once you understand the fundamentals of each of these tools and how they can work together, you should be able to tweak the scripts for many other different uses.

Special thanks to Phil Harvey, the creator of ExifTool, for creating and maintaing such a great freeware tool.

Notes on the shell scripts:

    • ExifTool,by default, creates backup originals of any file that it modifies.  I have chosen to delete those backup files in the DeleteGPS shell script to avoid creating too many confusing versions of files.  If you like the idea of a backup file, simply remove the second exiftool command in the script.  To restore any file from the backup, just type exiftool -restore_backup [filename to restore] at the command line.

Get More Camera Technica Greatness:

Subscribe to this Feed ◊   Follow us on Twitter ◊   Email Us


  1. hi, thanks for the step-by-step tutorial. it helped me understand more about the automator.
    i tried all the steps as you mentioned.

    nonetheless, somehow the GPS data stays in the file.
    (it’s a raw file and i had another software to “save” the separately recorded GPS data on the RAW file. Which created an xmp sidecar file with the same name as my photo. In LR3 I “updated the DNG preview and metadata”.

    Then I realized the GPS matching was wrong. I deleted the xmp and re-updated the file on LR3 but GPS stayed. So I used your approach, the GPS info shows both on LR3 and also on the txt file that the workflow creates.

    anything that I might have done wrong?

  2. Detail Man says:

    For Windows PC system users – the high quality, free, and non-invasive ExifTool GUI 4.xx is truly a joy to use – and it does not require ANY scripting whatsoever in order to use the GUI. It doesn’t get any better than that !

    Here’s the developer’s web-page (with instructions for easy, and completely and truly portable, installation and use):

    Here’s the ExifTool forum’s link:

    Look for the “ExifTool GUI Discussion about Bogdan’s ExifTool GUI for Windows” to find the latest version of ExifTool GUI.

    (As in the above article pertaining to the Mac system utility), you will need to obtain the latest version of ExifTool itself (for Windows PC) at:

  3. Thank you for making this understandable (and, shock horror, simple!) for someone with absolutely zilch scripting skills such as myself. Hugely appreciated.

  4. Thanks for the script – worked first time (and I have NO scripting skills). But now I am inspired! … Is there a way to take the data generated from a folder of images, and rather than writing to a file (one file per image), instead write each file’s data to a single excel file, with the data from each file being written across a row? I am a wildlife biologists working with 1000′s of images from remote cameras – it would be fantastic to be able to bring in the data generated by these cameras such as file name, temperature, moon phase, etc, and drop it into an excel (or csv) file….