Skip to content

Instantly share code, notes, and snippets.

@sps
Last active December 19, 2015 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sps/5915360 to your computer and use it in GitHub Desktop.
Save sps/5915360 to your computer and use it in GitHub Desktop.
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