[Originally posted by pixelpicker on 2009-05-13 12:15:19-07]Hello to all & special to Phil,
I want to create a second set for keywords caption and headline in the IPTC group to store corresponding information from another language.
What I tried up to now is to define a new set of tags in the .config file like this:
%Image::ExifTool::UserDefined = (
# IPTC tags are added to a specific record type (ie. application record):
'Image::ExifTool::IPTC::ApplicationRecord' => {
301 => {
Name => 'EKeywords',
Format => 'string[0,64]',
},
302 => {
Name => 'ECaption-Abstract',
Format => 'string[0,4000]',
},
303 => {
Name => 'EHeadline',
Format => 'string[0,600]',
},
},
);
In a first test I tried to copy the corresponding data outof the common iptc group into this new iptc tags with:
exiftool "-IPTC:ekeywords<keywords" "-IPTC:ecaption-abstract<caption-abstract" "-IPTC:eheadline<headline" DIR
Exiftool seems to do its job, but when I look into the metadata with: -a -G1 -s and with: -U I cant't find the new tags. I know that wit the keywords is a problem cause its a list tag but with both others it should have worked.
Could anybody give me a hint?
Many greetings from
pixelpicker
[Originally posted by exiftool on 2009-05-14 00:18:38-07]I suspect there is something wrong with your config file.
Did you put all of the tag definitions within a single
Image::ExifTool::UserDefined hash?
Post the config file here (inside a
...
block) and maybe I can figure out what is going on.
- Phil
[Originally posted by pixelpicker on 2009-05-14 00:48:50-07]This is the complete config file:
#------------------------------------------------------------------------------
# File: ExifTool_config --> ~/.ExifTool_config
#
# Description: Sample user configuration file for Image::ExifTool
#
# Notes: This example file shows how to define your own shortcuts and
# add new EXIF, IPTC, XMP, PNG, MIE and Composite tags, as well
# as how to specify preferred lenses for the LensID tag.
#
# Note that unknown tags may be extracted even if they aren't
# defined, but tags must be defined to be written. Also note
# that it is possible to override an existing tag definition
# with a new tag.
#
# To activate this file, rename it to ".ExifTool_config" and
# place it in your home directory or the exiftool application
# directory. This causes ExifTool to automatically load the file
# when run. Your home directory is determined by the first
# defined of the following environment variables:
#
# 1. EXIFTOOL_HOME
# 2. HOME
# 3. HOMEDRIVE + HOMEPATH
# 4. (the current directory)
#
# This sample file defines the following 13 new tags as well as a
# number of Shortcut and Composite tags:
#
# 1. EXIF:NewEXIFTag
# 2. IPTC:NewIPTCTag
# 3. XMP-xmp:NewXMPxmpTag
# 4. XMP-xxx:NewXMPxxxTag1
# 5. XMP-xxx:NewXMPxxxTag2
# 6. XMP-xxx:NewXMPxxxTag3
# 7. XMP-xxx:NewXMPxxxStructX
# 8. XMP-xxx:NewXMPxxxStructY
# 9. PNG:NewPngTag1
# 10. PNG:NewPngTag2
# 11. PNG:NewPngTag3
# 12. MIE-Meta:NewMieTag1
# 13. MIE-Test:NewMieTag2
#
# For detailed information on the definition of tag tables and
# tag information hashes, see lib/Image/ExifTool/README.
#------------------------------------------------------------------------------
# Shortcut tags are used when extracting information to simplify
# commonly used commands. They can be used to represent groups
# of tags, or to provide an alias for a tag name.
%Image::ExifTool::Shortcuts::UserDefined = (
MyShortcut => ['exif:createdate','exposuretime','aperture'],
MyAlias => 'FocalLengthIn35mmFormat',
);
# NOTE: All tag names used in the following tables are case sensitive.
# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
# All EXIF tags are added to the Main table, and WriteGroup is used to
# specify where the tag is written (default is ExifIFD if not specified):
'Image::ExifTool::Exif::Main' => {
0xd000 => {
Name => 'NewEXIFTag',
Writable => 'int16u',
WriteGroup => 'IFD0',
},
},
# IPTC tags are added to a specific record type (ie. application record):
'Image::ExifTool::IPTC::ApplicationRecord' => {
240 => {
Name => 'NewIPTCTag',
Format => 'string[0,16]',
},
},
# XMP tags may be added to existing namespaces:
'Image::ExifTool::XMP::xmp' => {
NewXMPxmpTag => { Groups => { 2 => 'Author' } },
},
# new XMP namespaces (ie. xxx) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
xxx => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::xxx',
# (see the definition of this table below)
},
},
},
# new PNG tags are added to the PNG::TextualData table:
'Image::ExifTool::PNG::TextualData' => {
NewPngTag1 => { },
NewPngTag2 => { },
NewPngTag3 => { },
},
# add a new MIE tag (MieTag1) and group (MIE-Test) to MIE-Meta
# (Note: MIE group names must NOT end with a number)
'Image::ExifTool::MIE::Meta' => {
NewMieTag1 => {
Writable => 'rational64u',
Units => [ qw(cm in) ],
},
Test => {
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::MIETest',
DirName => 'MIE-Test',
},
},
},
# Composite tags are added to the Composite table:
'Image::ExifTool::Composite' => {
# Composite tags are unique: The Require/Desire elements list
# tags that must/may exist, and the keys of these hashes are used
# as indices in the @val array of the ValueConv expression to
# derive the composite tag value. (See the Composite table in
# Image::ExifTool::Exif for more examples.)
BaseName => {
Require => {
0 => 'FileName',
},
# remove the extension from FileName
ValueConv => 'my $name=$val[0]; $name=~s/\..*?$//; $name',
},
# the following examples demonstrate simplifications which may be
# used if only one tag is Require'd or Desire'd:
# 1) the Require/Desire lookup may be replaced with a simple tag name
# 2) "$val" may be used to represent "$val[0]" in the expression
Extension => {
Require => 'FileName',
ValueConv => '$val=~/\.([^.]*)$/; $1',
},
# override CircleOfConfusion tag to use D/1750 instead of D/1440
CircleOfConfusion => {
Require => 'ScaleFactor35efl',
ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)',
PrintConv => 'sprintf("%.3f mm",$val)',
},
},
);
# This is a basic example of the definition for a new XMP namespace.
# This table is referenced through a SubDirectory tag definition
# in the %Image::ExifTool::UserDefined definition above.
# The namespace prefix for these tags is 'xxx', which corresponds to
# an ExifTool family 1 group name of 'XMP-xxx'.
%Image::ExifTool::UserDefined::xxx = (
GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
NAMESPACE => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' },
WRITABLE => 'string',
# replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
NewXMPxxxTag1 => { },
NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
NewXMPxxxTag3 => { List => 'Bag' },
# XMP structures are defined as SubDirectory's
NewXMPxxxStruct => {
SubDirectory => { },
Struct => 'MyStruct', # arbitrary name identifies entry in xmpStruct
List => 'Seq', # structures may also be elements of a list
},
# structure elements must be defined as separate tags. The tag ID's
# are the concatination of the structure tag ID with the ID of each
# structure element in turn. The list flag should be set if the
# parent structure is contained in a list.
NewXMPxxxStructX => { List => 1 },
NewXMPxxxStructY => { List => 1 },
);
# User-defined XMP structures are added to the xmpStruct lookup
%Image::ExifTool::UserDefined::xmpStruct = (
# A structure with 2 elements: X and Y
MyStruct => {
NAMESPACE => { 'test' => 'http://x.y.z/test/' },
# TYPE is optional -- it adds an rdf:type element to the structure
TYPE => 'http://x.y.z/test/xystruct',
X => { },
Y => { },
},
);
# Adding a new MIE group requires a few extra definitions
use Image::ExifTool::MIE;
%Image::ExifTool::UserDefined::MIETest = (
%Image::ExifTool::MIE::tableDefaults, # default MIE table entries
GROUPS => { 0 => 'MIE', 1 => 'MIE-Test', 2 => 'Document' },
WRITE_GROUP => 'MIE-Test',
NewMieTag2 => { }, # new user-defined tag in MIE-Test group
);
# A special 'Lenses' list can be defined to give priority to specific lenses
# in the logic to determine a lens model for the Composite:LensID tag
@Image::ExifTool::UserDefined::Lenses = (
'Sigma AF 10-20mm F4-5.6 EX DC',
'Tamron 35-90mm F4 AF',
);
#---- My own TagsA --------------------------------------------------------------------------
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyKeywords => {
Require => 'Keywords',
ValueConv => q{
my @list = ref $val ? @$val : ($val);
my $changed;
s/'/ /g and $changed = 1 foreach @list;
return $changed ? \@list : undef;
},
},
MyCaption => {
Require => 'Caption-Abstract',
ValueConv => q{ $val=~s/'/ /g ? $val : undef },
},
MyHeadline => {
Require => 'Headline',
ValueConv => q{ $val=~s/'/ /g ? $val : undef },
},
},
);
#---- My own TagsB -------------------------------------------------------------------------
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
KeywordsDeutsch => {
Require => 'IPTC:Keywords',
ValueConv => q{
my @list = ref $val ? @$val : ($val);
my $changed;
s/([^\|]*)\| .*/\1/ and $changed = 1 foreach @list;
return $changed ? \@list : undef;
},
},
KeywordsEnglish => {
Require => 'IPTC:Keywords',
ValueConv => q{
my @vals;
foreach (ref $val eq 'ARRAY' ? @$val : $val) {
push @vals, $2 if /(^|\|)\s*\s+(.*?)\s*(\||$)/;
}
return @vals ? \@vals : undef;
},
},
CaptionDeutsch => {
Require => 'IPTC:Caption-Abstract',
ValueConv => '$val =~ /^(.*?)\s*\|/s ? $1 : undef',
},
CaptionEnglish => {
Require => 'IPTC:Caption-Abstract',
ValueConv => '$val =~ /\|\s*(.*?)$/s ? $1 : undef',
},
HeadlineDeutsch => {
Require => 'IPTC:Headline',
ValueConv => '$val =~ /^(.*?)\s*\|/s ? $1 : undef',
},
HeadlineEnglish => {
Require => 'IPTC:Headline',
ValueConv => '$val =~ /\|\s*(.*?)$/s ? $1 : undef',
},
},
);
#---- My own TagsC -------------------------------------------------------------------------
%Image::ExifTool::UserDefined = (
'Image::ExifTool::IPTC::ApplicationRecord' => {
235 => {
Name => 'KeywordsENGL',
Format => 'string[0,64]',
},
236 => {
Name => 'CaptionENGL',
Format => 'string[0,2000]',
},
237 => {
Name => 'HeadlineENGL',
Format => 'string[0,600]',
},
},
);
#------------------------------------------------------------------------------
1; #end
Greetings
[Originally posted by pixelpicker on 2009-05-14 13:38:27-07]!! Thank you Phil !!

So this means I have just to rearrange the config file and put all definitions under the:
%Image::ExifTool::UserDefined = (
if I understand you correct.
I searched for the "lib/Image/ExifTool/README" that is mentioned in the config file but cant't find it. Since the use of the config file is very helpful for many cases, I'd like to know more. Could you tell me where to read or download it?
Best Greetings
Bette
[Originally posted by pixelpicker on 2009-05-14 14:30:47-07]Thank you again

I will download the full Perl distribution again to see all examples - since some time now I use your windows standalone cause its so nicly slim and uncomplicated.
Have a good day!
Greetings
Bette