Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
script for adding EXIF camera info for flickr
#!/usr/bin/perl
#
# Copyright (c) 2006 Sean P. Scanlon <sean.scanlon <-AT-> gmail.com>
# All rights reserved.
use strict;
use Getopt::Long;
use Image::MetaData::JPEG;
my %opt = ();
GetOptions(\%opt, 'file=s', 'make=s', 'model=s');
foreach (qw(file make model)) {
if (! $opt{ $_ } ) {
print "$0: --file=file.jpg --make=Kodak --model=Hawkeye\n";
exit;
}
}
# Create a new JPEG file structure object
my $file = new Image::MetaData::JPEG($opt{file});
die 'Error: ' . Image::MetaData::JPEG::Error() unless $file;
$file->set_Exif_data({Make => [$opt{make}], Model => [$opt{model}]}, 'IFD0_DATA', 'ADD');
$file->save($opt{file});
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment