A couple of AppleScript droplets to tweak EXIF timestamps
Monday, 14 February 2011
Most of the time I don’t really bother with the timestamp information that my camera embeds in each digital photo. In fact, I can’t remember the last time I checked to see if the clock was right.
Scanned photographs are an entirely different brew. They typically represent events from the distant past, and scanner software EXIF data is hit or miss.
I looked for commercial software to handle a few special cases of EXIF data troubles, but came up empty handed. So I wrote a few useful AppleScript droplets that do these tasks quite nicely, and I will share them here.
Warning!
These scripts use jhead to manipulate and rewrite your JPEG files!
Don’t be a fool. Experiment first with a safe set of throwaway JPEGs. And never use these tools on original files; always keep a backup.
Prerequisite
All of these scripts depend on a fine piece of free software called jhead written by Matthias Wandel.
Installation is not difficult, but it does involve the command line.
- Go to the jhead site
- Scroll down to the Releases section and look for Pre-built OS-X Intel executable
- Right click on the jhead link on that row and choose Save Linked File to “Downloads”
At this point, I found that jhead was saved as jhead.txt. Oh well. We needed to do some command-line magic anyway.
- Open a terminal window and enter the following:
1 2 3 4 | $ cd ~/Downloads $ mv jhead.txt jhead $ chmod 777 jhead $ sudo mv jhead /usr/local/bin |
These lines do the following:
- Lines 1 and 2 navigate to the Downloads directory and remove the “.txt” from the name
- Line 3 makes the file executable by everyone on your Mac
- Line 4 places the file in a public area where everyone on your Mac can see it (you will be prompted for your password)
Stripping All EXIF Data
Sometimes I receive files that have corrupt EXIF data. I had a large quantity of scanned files in my collection that claimed to be scanned some time in 2038, while others insisted that they had been around since 1901. Neither situation is good, and I found that standard EXIF editing tools may fail to change these corrupt EXIF sections.
The answer is to blow away the EXIF data.
Download: Strip EXIF
This zip file contains a compiled AppleScript application. You can unzip it and place the application on your desktop. Safari will probably unzip it for you when you click the link.
To be safe, open AppleScript Editor and use it to open the Strip EXIF app to see its magic.
Now you can drop any number of JPEG files onto the Strip EXIF app and it will kindly eviscerate each JPEG, removing all traces of EXIF data.
Adding Basic EXIF Data to a vanilla JPEG
Some tools create JPEG files without EXIF date and time information within. This is typically the hallmark of photo manipulation software and dodgy scanner software. And if you happened to use the Strip EXIF app to rip out a bad EXIF block, then you will want to replace it with a proper data block so that you can still use camera date and timestamps.
Download: Add Basic EXIF
Again, unzip the file, place the app on your desktop, and then drop any number of JPEG files onto Add Basic EXIF.
The app will set the EXIF date to the file creation timestamp.
Spreading EXIF Timestamps
This is the real reason why I wrote these scripts. I couldn’t find a satisfactory tool on the market that would allow me to automatically spread out the shooting times for a series of images.
Why would anyone want to do this? Because some processes give you fifty JPEG files all with the exact same creation time and exact same shooting time. I like to use file renaming tools to incorporate the shooting time in the filename, so that files sort by chronological order. This doesn’t work if all of the timestamps are the same.
So I wrote a little app that adjusts the first photo by one minute, the second by two minutes, and so on. If there are fifty photos, then the last one will have its shooting time adjusted by fifty minutes.
The result is a series of photos/scans that have different timestamps.
Download: Spread EXIF Timestamps
Again, please look at the short program before you run it.
Closing Thoughts
I hope that my favorite tool implements these tricks soon (A Better Finder Attributes, I’m looking at you!), but until then, I will be dropping my files onto these three little droplets.
The jhead tool is so versatile that I will probably end up with a whole slew of similar droplets that will do all kinds of spiffy stuff. Nevertheless, I would rather the commercial products already provided these features. Not everyone likes dipping into AppleScript and the command line!


