
Exiftool Metadata Insertion Script
Background
I have recently been developing a consistant way to insert metadata into images taken on my digital
camera that I want to upload onto Flickr.
There are of course a number of GUI tools for doing this but
what I wanted was a script or batch file solution, that would be able to insert the key metadata
elements or tags I had previously placed into a data file into the writeable metadata tag locations
inside an image file. As my camera uses JEPG images I focused on writable tags for JPEGs although I
think that the solution I have developed is likely to work for other image types... (I just haven't tested this!)
Solution
After some investigation I decided to use the very capable
ExifTool by Phil Harvey. Once I had downloaded the Windows Executable version of this tool and renamed
it to "Exiftool.exe". I copied it into the Windows directory so as to be able to just call it from a script.
I then identified the range of metadata tags I wanted to target and inserted both the tag and the data into a
text file using the Exiftool syntax. With this preperation done I then used
Windows Powershell... to write a short script to do the actual work!
Activation
The script I have written requires 2 arguments. The first argument is the path to the datafile I mention above.
The second argument is to an image file OR a directory of image files. When run the script uploads the data
in the data text file. It then locates and uploads the location(s) of the file(s) to be processed. The script
then writes to each image that has been targeted the metadata from the data file. In this way I now have a
simple and elegant way to ensure that the images I create have appropriate metadata inserted into them before
I upload them to Flickr.
Installation
A copy of the Powershell script together with a command file for
calling the script with the required arguments and my intial data file is available as a zip file.
When opened the zip file will create a directory called Images. Place this directory into C:\ drive. Copy into this directory some
JEPG images and then test my process! I have left a final command in the script to call the Exiftool with a -k argument which
will make it display the metadata in the last image processed. In this way you can check the validity of the script.
Once you have done this change the metadata values in the text data file to refect your own needs and see if the
process works for your data...
Prerequisites
You will need to have downloaded the
ExifTool by Phil Harvey, inserting this into the Windows directory as I describe above in the "Solution".
Also you will need Microsoft's
Windows Powershell... which was released late 2006, on any workstation on which you want to run this script.
You will also need to set the Powershell script execution policy to: "set-executionpolicy remotesigned". The
prerequisites for Powershell on XP are Service Pack 2 and the Microsoft .NET Framework version 2.0
|