Virtually any digital camera stores the time a foto is taken directly within the image file. Unfortunately, most digital camera's clocks are extremely inaccurate, sometimes do not adjust correctly to daylight saving time and usually are very seldom adjusted to match the correct time. This causes major headaches if you want to have accurate timestamps within your digital fotos - or need to have, because you want to correlate your digital images with recorded GPS coordinates to geolocate them.
To simplify image timestamp adjustment by an order of a magnitude, I created exiftimeadjust. exiftimeadjust is a tiny script which takes some specifically taken sample pictures, called calibration photo hereafter, to derive how your image's timestamps will be fixed best.
To be able to use exiftimeadjust to fix your images, you simply need to take a few additional fotos of a radio controlled clock or the clock of a GPS receiver during the course of some days. Usually, three or four of these images suffice. You just need to take care NOT to adjust your camera's clock manually any more as long as you want to use these images as calibration images for image time correciton. In order to fix your image timestamps after eg. returning from the holidays you create a small text file which lists the names of these calibration images togther with the time the clock shows on these images. Exiftimeadjust uses this information together with the time stamps stores within the calibration image files to compute a linear image time correction function, assuming a constant drift of the camera's clock. Using this mechanism, the camera's absolute date / time setting is not relevant any more, it may be wrong by 30 seconds or 5 years and it may drift by 30 seconds each day - it doesn't matter. (You just need to take care of automatic DST adjustments in your digital camera, of course - preferrably, you should disable it, if possible.)
Strictly speaking, two calibration photos would suffice to compute a linear correction function. However, if you provide three calibration images or more, exiftimeadjust can perform sanity checks and can warn you if your camera clock's drift does not match its expectations, instead of completely mangling your images time stamps.
You'll get best results if you take the calibaration fotos between the fotos of which the timestamps should be adjusted at a later time. As an example, if you're on holiday, taking holday fotos, simply take an additional calibration foto every few days which you later use to adjust your hoiday photo's time stamps.
Currently exiftimeadjust consists of 2 Pyhton files which can be retrieved directly from the ExifTimeAdjust Subversion Repository. ExifTimeAdjust is Free Software gouverned by the GNU General Public License.
ExifTimeAdjust requires a Python 2.4-interpreter or a newer version as well as the program exiv2 (Debian-package: exiv2) for image meta data manipulation.
Exiftimeadjust is used in two simple steps:
To enable exiftimeadjust to compute a time correction function and in turn to generate a time correction file, you must create a small text file which contains the name of a calibration image file next to the date and time you can see on the clock photographed on that image. This information must be separated by a comma, the date / time specification must be in German or GPS format.
An example file using date / time specifications in German format would look as follows:
IMG_1.JPG,26.06.2007 22:22:22 IMG_2.JPG,28.06.2007 20:55:59 IMG_3.JPG,30.06.2007 09:48:33The same file using GPS formatted date / time specifications is given below:
IMG_1.JPG,2007:06:26 22:22:22 IMG_2.JPG,2007:06:28 20:55:59 IMG_3.JPG,2007:06:30 09:48:33Assuming this file is called corr_mycam.csv you can generate a time correction file called mycam.corr using the following command:
./exiftimeadjust.py -c mycam.corr corr_mycam.csv
WARNING: exiftimeadjust obviously will alter your image files to fix the time stamps. This may go wrong in case of a hard- or software failure, and may also lead to unexpected results (read: it may mangle your images timestamps up to a point where the damage cannot be repaired any more) if you accidentially fix
the same image(s) twice or apply the wrong time correction file to your images. Take care you have a readable backup of all images you're going to alter using exiftimeadjust.
Exiftimeadjust currently uses exiv2 (Debian-package: exiv2) to adjust the image's timestamps, thus it must be installed and the exiv2 binary must be in the system's program search path.
Once a correction file for a set of images exists, it's pretty simply to adjust the timestamps in this set:
./exiftimeadjust.py -a mycam.corr *.JPG
for example will adjust all JPG
-files in the current directory.