Skip to content

Instantly share code, notes, and snippets.

@sps sps/exif_makemodel.pl
Last active Dec 19, 2015

Embed
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.