Batch EXIF Tagging?
August 18, 2005 2:34 PM
Subscribe
Is there an EXIF wiz in the house?
I have a large number of photos that have their "date taken" in the filename (YYMMDD-##.jpg, to be exact), but they have no EXIF info. Before I upload them to flickr, I'd like to change that. Since it's a lot of pictures, I'm looking for a way to automate the process (plus it's a matter of principle, since the information is already digital I shouldn't have to do it by hand.)
I know about EXIFer, but it doesn't seem to have this kind of batch function. Is there any other program that will let me batch-process these files and add EXIF information taken from the filename? I know there are taggers that do this kind of thing for mp3s, so why not for EXIF? Thankyoumuch.
posted by muckster to computers & internet (19 comments total)
1 user marked this as a favorite
use Image::IPTCInfo;
use strict;
foreach my $line (<>) {
my ($jpg, $title, $caption) = split(/\t/, $line);
my $info = new Image::IPTCInfo($jpg);
if (defined($info)) {
$info->AddKeyword('some keyword');
$info->SetAttribute('province/state', "");
$info->SetAttribute('city', "San Francisco");
$info->SetAttribute('country/primary location name', "");
$info->SetAttribute('category', "some category");
$info->SetAttribute('object name', $title);
$info->SetAttribute('headline', $title);
$info->SetAttribute('by-line title', $title);
$info->SetAttribute('caption/abstract', $caption);
$info->SetAttribute('copyright notice', "");
$info->SaveAs("out/$jpg");
print "Saving $jpg...\n";
}
}
On preview, I forget not everyone's a programmer; I was assuming that parsing the filename for the date could be an exercise left for the reader. Let me know if that isn't the case.>
posted by Loser at 2:55 PM on August 18, 2005