Hello, Phil. Here's my code: I really appreciate this.
I'm running the config code inline for now:
CPAN::Forum
Image-ExifTool - Re: Help needed with adding custom tags
| Posted on Thu Mar 20 14:52:36 2008 by sparkie in response to 7422 (See the whole thread of 13) |
| Re: Help needed with adding custom tags |
|
Hello, Phil. Here's my code: I really appreciate this. I'm running the config code inline for now:
#!usr/bin/perl
use warnings;
# ============================== Load modules ====================================
#use DBI;
use Image::ExifTool qw(:Public);
my $picFile, $picFileMod;
$picFile = 'C:\pics\pic2.jpg';
$picFileMod = 'C:\pics\pic2ModByExifTool.jpg';
#define ExifTool object;
my $ExifTool = new Image::ExifTool;
%$ExifTool::UserDefined::defra = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-defra', 2 => 'Image' },
NAMESPACE => { 'defra' => 'http://ns.defra.com/' },
WRITABLE => 'string',
Tag1 => {},
Tag2 => {},
Tag3 => {}
);
%$ExifTool::UserDefined = (
# new XMP namespaces (ie. XMP-xxx) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
defra => {
SubDirectory => {
TagTable => '%$ExifTool::UserDefined::defra'
},
},
}
);
if(-e $picFile)
{
my $info = $ExifTool->ImageInfo($picFile);
print '\n';
print '\n';
foreach (keys %$info) {
print "$_ => $$info{$_}\n";
}
$ExifTool->SetNewValue('Tag1','Val1');
$ExifTool->SetNewValue('Tag2','Val2');
$ExifTool->SetNewValue('Tag3','Val3');
$ExifTool->WriteInfo($picFile, $picFileMod);
}
print 'After mod=============================================== \n';
my $info = ImageInfo($picFileMod);
foreach (keys %$info) {
print "$_ => $$info{$_}\n";
}
|
| Direct Responses: 7424 | Write a response |
(4)
]