Adding EXIF data to Treo 650 cameraphone pics

I just got a Flickr Pro account and I’ve been uploading my digital photos. My Treo 650 doesn’t stick EXIF data in the JPEG images it captures, so Flickr assumes that the “posted on” date is the same as the “taken on” date.

The file attributes of the Photo_MMDDYY_NNN.jpg files accurately reflect what time the picture was taken, so here’s a short Perl script to embed that data into the EXIF part of each file:


#!/usr/local/bin/perl -w

use strict;

use POSIX ();

foreach my $file (@ARGV) {

my $mtime = (stat($file))[9];

my $ts = POSIX::strftime("%Y:%m:%d %T", localtime($mtime));

system("exiftool", "-P", "-DateTimeOriginal=$ts",

"-Make=PALMONE", "-Model=Treo 650", $file);

}

exit(0);

I tried using the jhead tool to do this, but it won’t create an EXIF header if one doesn’t already exist. The Image::ExifTool perl module had the functionality I needed.

There’s certainly a way to use the Image::ExifTool perl module directly, but it was easier to just shellout to the command-line utility.