Hi Phil,
in the past you kindly helped creating the code for our Exiftool config file to join multiple tags into a single caption. We only need a small change now, but I am seemingly unable to do it myself. Could you please help.
We need to have a colon after all location tags, changing the final string from something like:
Lama Zopa Rinpoche with Vens. Khen Rinpoche Geshe Chonyi, Rabjor, Topbgye and Holly in the Singapore Botanic Gardens, Singapore, Singapore, Photography:Venerable Roger Kunsang, Sep-2022
to
Lama Zopa Rinpoche with Vens. Khen Rinpoche Geshe Chonyi, Rabjor, Topbgye and Holly in the Singapore Botanic Gardens, Singapore, Singapore. Photography: Venerable Roger Kunsang, Sep-2022
Note the "." after the second "Singapore"
And while this is a very rare case, it would be great if the second "Singapore" could be omitted. In other words, if City and Country are the same, it should be put only once.
The current code is:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
WebCaptionTag => {
Desire => {
0 => 'XMP:Coverage',
#previously: 0 => 'XMP:Description',
1 => 'XMP:Location',
2 => 'XMP:City',
3 => 'XMP:Country',
4 => 'XMP:Creator',
5 => 'EXIF:CreateDate',
},
ValueConv => q{
my (@loc, @list);
defined $val[$_] and push @loc, $val[$_] foreach 1..3;
push @list, join(', ', @loc) if @loc;
if (defined $val[4]) {
$val[4] = join(', ', @{$val[4]}) if ref $val[4] eq 'ARRAY';
push @list, "Photographer: $val[4]"
}
push @list, $prt[5] if defined $prt[5];
my $prefix = defined($val[0]) ? "$val[0] - " : '';
return $prefix . join('; ', @list);
},
},
},
);
Thanks a lot in advance for your help.
PH Edit: Put code in [code][/code] blocks
small update: we recently had several case where the editor added an extra trailing space to the description, which is the first tag. Would be awesome if that could be removed where present. That might not be a big deal, but as I do not know PERL, for me it is :)
Quote from: Harald on October 19, 2022, 05:42:56 AMWe need to have a colon after all location tags
If you mean a period and not a colon, this may do it for you:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
WebCaptionTag => {
Desire => {
0 => 'XMP:Coverage',
#previously: 0 => 'XMP:Description',
1 => 'XMP:Location',
2 => 'XMP:City',
3 => 'XMP:Country',
4 => 'XMP:Creator',
5 => 'EXIF:CreateDate',
},
ValueConv => q{
my (@loc, @list);
defined $val[$_] and push @loc, $val[$_] foreach 1..3;
if (defined $val[4]) {
$val[4] = join(', ', @{$val[4]}) if ref $val[4] eq 'ARRAY';
push @list, "Photographer: $val[4]"
}
push @list, $prt[5] if defined $prt[5];
my $prefix = defined($val[0]) ? "$val[0] - " : '';
$prefix .= join(', ', @loc) . '. ' if @loc;
$prefix .= join('; ', @list);
$prefix =~ s/ +/ /g;
$prefix =~ s/ $//;
return $prefix;
},
},
},
);
I have also removed double spaces and any trailing space.
- Phil
Phil, you are my here :)
Thanks so much for you quick help. Works like a charm. And yes, "." and not ":", sorry.
I guess the "Singapore, Singapore" problem would be too much to ask? No problem, it occurs very rarely and we can hand edit those captions.
Thanks again for your always great and quick help. Very much appreciated!
The double country name can certainly be fixed, but I have 2 questions:
1. Can you show me the values of the source tags for a case like this?
2. Why is it separated by a comma and not a semicolon is in your config file?
- Phil
======== ./IMG_0558.jpg
City : Singapore
Country : Singapore
Date Created : 2022:09:04
Creator : Roger Kunsang
Coverage : Lama Zopa Rinpoche signing a large thangka being offered to a student
1 directories scanned
1 image files read
======== ./IMG_0558.jpg
Date Created : 2022:09:04
Web Caption Tag : Lama Zopa Rinpoche signing a large thangka being offered to a student, Amitabha Buddhist Centre, Singapore, Singapore. Photo by Roger Kunsang, 2022:09:04
This is the original tags and the web caption tag for a photo taken on iPhone and exported from Assetbank with Create Date mapped to IPTC:CreateDate (I have to use this tag as photos from Signal or Whatsapp have no dates and Assetbank does not allow download mapping into EXIF:CreateDate). As you can see your code works perfectly, except that the date should have the format MMM-YYYY, as in Sep-2022. Could you add that? I have altered the code to use IPTC:CreateDate.
And for the dual Singapore: Our editors prefer the format where all location info is separated by comma. Not sure if there is an international standard for these things ...
Current code in ConfigFile is:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
WebCaptionTag => {
Desire => {
0 => 'XMP:Coverage',
#previously: 0 => 'XMP:Description',
1 => 'XMP:Location',
2 => 'XMP:City',
3 => 'XMP:Country',
4 => 'XMP:Creator',
# Harald 20-10-2022 changed to'IPTC:DateCreated'
# as this is specified in embedded data mapping in AB for download.
5 => 'IPTC:DateCreated',
# 5 => 'XMP:CreateDate',
},
ValueConv => q{
my (@loc, @list);
defined $val[$_] and push @loc, $val[$_] foreach 1..3;
if (defined $val[4]) {
$val[4] = join(', ', @{$val[4]}) if ref $val[4] eq 'ARRAY';
push @list, "Photo by $val[4]"
}
push @list, $prt[5] if defined $prt[5];
my $prefix = defined($val[0]) ? "$val[0], " : '';
$prefix .= join(', ', @loc) . '. ' if @loc;
$prefix .= join(', ', @list);
$prefix =~ s/ +/ /g;
$prefix =~ s/ $//;
return $prefix;
},
},
},
);
Thanks for all your valuable help
PH Edit: put code in [code][/code] blocks
Here you go. This config file removes Country from the output if it is the same as City, and formats the date as you requested:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
WebCaptionTag => {
Desire => {
0 => 'XMP:Coverage',
#previously: 0 => 'XMP:Description',
1 => 'XMP:Location',
2 => 'XMP:City',
3 => 'XMP:Country',
4 => 'XMP:Creator',
# Harald 20-10-2022 changed to'IPTC:DateCreated'
# as this is specified in embedded data mapping in AB for download.
5 => 'IPTC:DateCreated',
# 5 => 'XMP:CreateDate',
},
ValueConv => q{
my (@loc, @list);
defined $val[$_] and push @loc, $val[$_] foreach 1..3;
pop @loc if @loc > 1 and $loc[-1] eq $loc[-2];
if (defined $val[4]) {
$val[4] = join(', ', @{$val[4]}) if ref $val[4] eq 'ARRAY';
push @list, "Photo by $val[4]"
}
if (defined $val[5]) {
$_ = "$val[5] 00:00:00";
DateFmt('%b-%Y');
push @list, $_;
}
my $prefix = defined($val[0]) ? "$val[0], " : '';
$prefix .= join(', ', @loc) . '. ' if @loc;
$prefix .= join(', ', @list);
$prefix =~ s/ +/ /g;
$prefix =~ s/ $//;
return $prefix;
},
},
},
);
- Phil
Edit: I suspect your command uses a -d option to set the date/time formatting, but changing XMP:CreateDate to IPTC:DateCreated broke this because the current version of ExifTool doesn't apply the -d formatting to date-only tags such as IPTC:DateCreated. (Hence the reason I formatted the date manually in the config file using the DateFmt function.) However, I will enhance ExifTool 12.50 to use the same trick as I applied here (ie. adding a dummy time) to allow the -d option to work for tags like this.
Hey Phil,
thanks so much for your incredible help and quick responses.
I copied over the code, but unfortunately there seems to be some glitch. It keeps saying "No writable tags set from <image name>". It must be related to the most recent changes as it had been working fine on my last test. Note that I am running the following batch file on a Windows Server 2016:
------------------------------------------------------------------------------------
X:
cd \SyncToGooglePhotos\2022\
exiftool -r -P -overwrite_original_in_place -EXT jpg -EXT jpeg -d "%%B %%d, %%Y" "-iptc:caption-abstract<WebCaptionTag" .
exiftool -r -P -overwrite_original_in_place -EXT jpg -EXT jpeg -d "%%B %%d, %%Y" "-description<WebCaptionTag" .
exiftool -filename .
------------------------------------------------------------------------------------
any ideas?
Hi Harald,
I think it was likely a cut-n-paste problem copying from the forum post because it works for me. I'll attach the file instead.
Also make sure the config file is installed correctly.
- Phil
Also, you should do this instead of running 2 separate commands:
cd \SyncToGooglePhotos\2022\
exiftool -r -P -overwrite_original_in_place -EXT jpg -EXT jpeg "-iptc:caption-abstract<WebCaptionTag" "-description<WebCaptionTag" .
(I've also removed the now-unnecessary -d option)
- Phil
unfortunately the problem persists. I cannot see an icon to attach a file, so please forgive me for adding the whole config file below. I have also tried to just paste the new web caption tag part into a previous backup of the file, but did not work either. The config file is in the folder Windows(C:) /Users/admin and has worked so far.
And thanks for simplifying the script in the batch file.
#------------------------------------------------------------------------------
# File: example.config
#
# Description: Example 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, and
# define new file types and default ExifTool option values.
#
# 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 user-defined tag.
#
# To activate this file, rename it to ".ExifTool_config" and
# place it in your home directory or the exiftool application
# directory. (On Windows and Mac systems this must be done via
# the command line since the GUI's don't allow filenames to begin
# with a dot. Use the "rename" command in Windows or "mv" on the
# Mac.) 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)
#
# Alternatively, the -config option of the exiftool application
# may be used to load a specific configuration file (note that
# this must be the first option on the command line):
#
# exiftool -config example.config ...
#
# This example file defines the following 16 new tags as well as
# a number of Shortcut and Composite tags:
#
# 1. EXIF:NewEXIFTag
# 2. GPS:GPSPitch
# 3. GPS:GPSRoll
# 4. IPTC:NewIPTCTag
# 5. XMP-xmp:NewXMPxmpTag
# 6. XMP-exif:GPSPitch
# 7. XMP-exif:GPSRoll
# 8. XMP-xxx:NewXMPxxxTag1
# 9. XMP-xxx:NewXMPxxxTag2
# 10. XMP-xxx:NewXMPxxxTag3
# 11. XMP-xxx:NewXMPxxxStruct
# 12. PNG:NewPngTag1
# 13. PNG:NewPngTag2
# 14. PNG:NewPngTag3
# 15. MIE-Meta:NewMieTag1
# 16. 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::UserDefined::Shortcuts = (
MyVideoTags => ['XMP:country', 'XMP:City', 'XMP:location', 'XMP-iptcExt:PersonInImage', 'XMP:Event', 'XMP:CreatorWorkURL', 'XMP:Createdate', 'XMP:Description', 'XMP:MetadataDate', 'XMP:Creator', 'FILE:Filename', 'QuickTime:Duration', 'QuickTime:MajorBrand', 'QuickTime:CompressorID', 'QuickTime:BitDepth', 'Composite:AvgBitrate', 'QuickTime:Imageheight', 'QuickTime:VideoFrameRate'],
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' => {
# Example 1. EXIF:NewEXIFTag
0xd000 => {
Name => 'NewEXIFTag',
Writable => 'int16u',
WriteGroup => 'IFD0',
},
# add more user-defined EXIF tags here...
},
# the Geotag feature writes these additional GPS tags if available:
'Image::ExifTool::GPS::Main' => {
# Example 2. GPS:GPSPitch
0xd000 => {
Name => 'GPSPitch',
Writable => 'rational64s',
},
# Example 3. GPS:GPSRoll
0xd001 => {
Name => 'GPSRoll',
Writable => 'rational64s',
},
},
# IPTC tags are added to a specific record type (eg. application record):
# (Note: IPTC tag ID's are limited to the range 0-255)
'Image::ExifTool::IPTC::ApplicationRecord' => {
# Example 4. IPTC:NewIPTCTag
160 => {
Name => 'NewIPTCTag',
Format => 'string[0,16]',
},
# add more user-defined IPTC ApplicationRecord tags here...
},
# XMP tags may be added to existing namespaces:
'Image::ExifTool::XMP::xmp' => {
# Example 5. XMP-xmp:NewXMPxmpTag
NewXMPxmpTag => { Groups => { 2 => 'Author' } },
# add more user-defined XMP-xmp tags here...
},
# special Geotag tags for XMP-exif:
'Image::ExifTool::XMP::exif' => {
# Example 6. XMP-exif:GPSPitch
GPSPitch => { Writable => 'rational', Groups => { 2 => 'Location' } },
# Example 7. XMP-exif:GPSRoll
GPSRoll => { Writable => 'rational', Groups => { 2 => 'Location' } },
},
# new XMP namespaces (eg. xxx) must be added to the Main XMP table:
'Image::ExifTool::XMP::Main' => {
# namespace definition for examples 8 to 11
xxx => { # <-- must be the same as the NAMESPACE prefix
SubDirectory => {
TagTable => 'Image::ExifTool::UserDefined::xxx',
# (see the definition of this table below)
},
},
# add more user-defined XMP namespaces here...
},
# new PNG tags are added to the PNG::TextualData table:
'Image::ExifTool::PNG::TextualData' => {
# Example 12. PNG:NewPngTag1
NewPngTag1 => { },
# Example 13. PNG:NewPngTag2
NewPngTag2 => { },
# Example 14. PNG:NewPngTag3
NewPngTag3 => { },
},
# add a new MIE tag (NewMieTag1) and group (MIE-Test) to MIE-Meta
# (Note: MIE group names must NOT end with a number)
'Image::ExifTool::MIE::Meta' => {
# Example 15. MIE-Meta:NewMieTag1
NewMieTag1 => {
Writable => 'rational64u',
Units => [ 'cm', 'in' ],
},
# new MIE "Test" group for example 16
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 specify
# tags that must/may exist, and the keys of these hashes are used as
# indices in the @val array of the ValueConv expression to access
# the numerical (-n) values of these tags. All Require'd tags must
# exist for the Composite tag to be evaluated. If no Require'd tags
# are specified, then at least one of the Desire'd tags must exist.
# See the Composite table in Image::ExifTool::Exif for more
# examples, and lib/Image/ExifTool/README for all of the details.
BaseName => {
Require => {
0 => 'FileName',
},
# remove the extension from FileName
ValueConv => '$val[0] =~ /(.*)\./ ? $1 : $val[0]',
},
# the next few examples demonstrate simplifications which may be
# used if only one tag is Require'd or Desire'd:
# 1) the Require lookup may be replaced with a simple tag name
# 2) "$val" may be used to represent "$val[0]" in the expression
FileExtension => {
Require => 'FileName',
ValueConv => '$val=~/\.([^.]*)$/; $1',
},
# override CircleOfConfusion tag to use D/1750 instead of D/1440
CircleOfConfusion => {
Require => 'ScaleFactor35efl',
Groups => { 2 => 'Camera' },
ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)',
# an optional PrintConv may be used to format the value
PrintConv => 'sprintf("%.3f mm",$val)',
},
# generate a description for this file type
FileTypeDescription => {
Require => 'FileType',
ValueConv => 'GetFileType($val,1) || $val',
},
# calculate physical image size based on resolution
PhysicalImageSize => {
Require => {
0 => 'ImageWidth',
1 => 'ImageHeight',
2 => 'XResolution',
3 => 'YResolution',
4 => 'ResolutionUnit',
},
ValueConv => '$val[0]/$val[2] . " " . $val[1]/$val[3]',
# (the @prt array contains print-formatted values)
PrintConv => 'sprintf("%.1fx%.1f $prt[4]", split(" ",$val))',
},
# [advanced] select largest JPEG preview image
BigImage => {
Groups => { 2 => 'Preview' },
Desire => {
0 => 'JpgFromRaw',
1 => 'PreviewImage',
2 => 'OtherImage',
# (DNG and A100 ARW may be have 2 PreviewImage's)
3 => 'PreviewImage (1)',
},
# ValueConv may also be a code reference
# Inputs: 0) reference to list of values, 1) ExifTool object
ValueConv => sub {
my $val = shift;
my ($image, $bigImage, $len, $bigLen);
foreach $image (@$val) {
next unless ref $image eq 'SCALAR';
# check for JPEG image (or "Binary data" if -b not used)
next unless $$image =~ /^(\xff\xd8\xff|Binary data (\d+))/;
$len = $2 || length $$image; # get image length
# save largest image
next if defined $bigLen and $bigLen >= $len;
$bigLen = $len;
$bigImage = $image;
}
return $bigImage;
},
},
# **** ADD ADDITIONAL COMPOSITE TAG DEFINITIONS HERE ****
},
);
# 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', # (default to string-type tags)
# Example 8. XMP-xxx:NewXMPxxxTag1 (an alternate-language tag)
# - replace "NewXMPxxxTag1" with your own tag name (eg. "MyTag")
NewXMPxxxTag1 => { Writable => 'lang-alt' },
# Example 9. XMP-xxx:NewXMPxxxTag2 (a string tag in the Author category)
NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
# Example 10. XMP-xxx:NewXMPxxxTag3 (an unordered List-type tag)
NewXMPxxxTag3 => { List => 'Bag' },
# Example 11. XMP-xxx:NewXMPxxxStruct (a structured tag)
# - example structured XMP tag
NewXMPxxxStruct => {
# the "Struct" entry defines the structure fields
Struct => {
# optional namespace prefix and URI for structure fields
# (required only if different than NAMESPACE above)
NAMESPACE => { 'test' => 'http://x.y.z/test/' },
# optional structure name (used for warning messages only)
STRUCT_NAME => 'MyStruct',
# optional rdf:type property for the structure
TYPE => 'http://x.y.z/test/xystruct',
# structure fields (very similar to tag definitions)
X => { Writable => 'integer' },
Y => { Writable => 'integer' },
# a nested structure...
Things => {
List => 'Bag',
Struct => {
NAMESPACE => { thing => 'http://x.y.z/thing/' },
What => { },
Where => { },
},
},
},
List => 'Seq', # structures may also be elements of a list
},
# Each field in the structure has an automatically-generated
# corresponding flattened tag with an ID that is the concatenation
# of the original structure tag ID and the field name (after
# capitalizing the first letter of the field name if necessary).
# The Name and/or Description of these flattened tags may be changed
# if desired, but all other tag properties are taken from the
# structure field definition. When this is done, the "Flat" flag
# must also be set in the tag definition. For example:
NewXMPxxxStructX => { Name => 'SomeOtherName', Flat => 1 },
);
# 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',
# Example 16. MIE-Test:NewMieTag2
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',
'Tokina AF193-2 19-35mm f/3.5-4.5',
);
# User-defined file types to recognize
%Image::ExifTool::UserDefined::FileTypes = (
XXX => { # <-- the extension of the new file type (case insensitive)
# BaseType specifies the format upon which this file is based.
# If BaseType is defined, then the file will be fully supported,
# and in this case the Magic pattern should not be defined
BaseType => 'TIFF',
MIMEType => 'image/x-xxx',
Description => 'My XXX file type',
},
YYY => {
# without BaseType, the file will be recognized but not supported
Magic => '0123abcd', # regular expression to match at start of file
MIMEType => 'application/test',
Description => 'Test imaginary file type',
},
ZZZ => {
# if neither BaseType nor Magic are defined, the file will be
# recognized by extension only. MIMEType will be application/unknown
# unless otherwise specified
Description => 'My ZZZ file type',
},
);
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
WebCaptionTag => {
Desire => {
0 => 'XMP:Coverage',
#previously: 0 => 'XMP:Description',
1 => 'XMP:Location',
2 => 'XMP:City',
3 => 'XMP:Country',
4 => 'XMP:Creator',
# Harald 20-10-2022 changed to'IPTC:DateCreated'
# as this is specified in embedded data mapping in AB for download.
5 => 'IPTC:DateCreated',
# 5 => 'XMP:CreateDate',
},
ValueConv => q{
my (@loc, @list);
defined $val[$_] and push @loc, $val[$_] foreach 1..3;
pop @loc if @loc > 1 and $loc[-1] eq $loc[-2];
if (defined $val[4]) {
$val[4] = join(', ', @{$val[4]}) if ref $val[4] eq 'ARRAY';
push @list, "Photo by $val[4]"
}
if (defined $val[5]) {
$_ = "$val[5] 00:00:00";
DateFmt('%b-%Y');
push @list, $_;
}
my $prefix = defined($val[0]) ? "$val[0], " : '';
$prefix .= join(', ', @loc) . '. ' if @loc;
$prefix .= join(', ', @list);
$prefix =~ s/ +/ /g;
$prefix =~ s/ $//;
return $prefix;
},
},
},
);
# Specify default ExifTool option values
# (see the Options function documentation for available options)
%Image::ExifTool::UserDefined::Options = (
CoordFormat => '%.6f', # change default GPS coordinate format
Duplicates => 1, # make -a default for the exiftool app
GeoMaxHDOP => 4, # ignore GPS fixes with HDOP > 4
LargeFileSupport => 1,
);
#------------------------------------------------------------------------------
1; #end
PH Edit: Please put your code in [code][/code] blocks
I can't tell in the pasted version whether all the characters are proper ASCII because the forum changes them for me. This is possibly your problem if you have pasted some Unicode non-breaking-spaces or something like that.
- Phil
I compared the two last versions and found that the differences are only on two positions. I commented out the first one, that eliminates equal locations. That did not make a difference.
I then commented out the date formatting and replaced it with the simple line from the previous version and it works.
Thus there is something not working in this piece of code:
if (defined $val[5]) {
$_ = "$val[5] 00:00:00";
DateFmt('%b-%Y');
push @list, $_;
}
I notice that you used to write $prt[5]
push @list, $prt[5] if defined $prt[5];
But now you are using $val[5]. Are they both valid?
Copy - paste has worked for all my trials, so there is definitely no issue here :)
$val[5] is just the unformatted version of $prt[5].
The only thing I can think of is that you are using a very old (> 5 years) version of ExifTool before the DateFmt feature was added because the config file I attached works fine for me here with the current version of ExifTool. If it doesn't work for you with a recent version of ExifTool, then upload a sample image so I can try to reproduce your problem.
- Phil
That's exactly it. We have just switched server and I would have thought that our IT installed the latest version but it seems he copied over the old one. It is 9.49 which according to your history is from 2014!
I will install the latest version and test again. Thanks so much for catching this.
Hi Phil,
almost there. The script works very well now and does everything it is supposed to do. So it was indeed related to the version.
It does give a warning fairly often though which reads:
ITPCDigest is not current. XMP might be out of sync.
I noticed that when outputting all metadata with exiftool -G .
it then sometimes starts applying parts of the metadata as command, resulting in something like
"Caption-Abstact" is not recognised as a command or .BAT file.
Any idea where this comes from?
kind regards,
Harald
_____________________________
Hi Harald,
Quote from: Harald on October 25, 2022, 09:57:34 AMITPCDigest is not current. XMP might be out of sync.
Something has updated the IPTC without updating IPTCDigest, which means that it probably didn't update the corresponding XMP so the XMP could be out of date. To fix this properly requires you to decide whether you prefer the XMP or IPTC, then update the out-of-date information and set the IPTCDigest.
QuoteI noticed that when outputting all metadata with exiftool -G .
it then sometimes starts applying parts of the metadata as command, resulting in something like
"Caption-Abstact" is not recognised as a command or .BAT file.
What exactly is your command? And how are you executing the command? (From a .bat file it seems?)
- Phil
The command is the one you made in this thread
exiftool -r -P -overwrite_original_in_place -EXT jpg -EXT jpeg "-iptc:caption-abstract<WebCaptionTag" "-description<WebCaptionTag" .
Does not make a difference whether I call it from a .BAT file or directly.
This produces the warning "ITPCDigest is not current. XMP might be out of sync."
In any case I could not reproduce at this point the problem where suddenly tags were interpreted as commands, so I will close this thread for now. Thanks so much for all your invaluable help, Phil.
The IPTCDigest is not current. XMP may be out of sync is there to let you know that the IPTCDigest has been changed from the last time it was set. It is simply a Warning, not an Error.
The purpose of the IPTCDigest to let programs that are aware of this tag know that the IPTC data may no longer match the XMP data. In this case, the program is supposed to give the IPTC data priority over the XMP data. Lightroom, for example, will ignore XMP data in favor of IPTC data if this is not current.
If you know that the data is in sync, you can fix this warning by using
exiftool -IPTCDigest=new /path/to/files/
You can add that to any command where you are updating both IPTC and XMP data.
Now, here's my opinion. In the past when XMP was a new standard, this might have been useful. But XMP support is now much more prevalent. If the programs you use support XMP, then you should ditch the older IPTC IIM/Legacy standard and remove the IPTCDigest. XMP really is a much better standard.
Myself, even though I still have to use the IPTC standard (seriously, Irfanview, XMP support has been requested for over a decade†), I just delete the IPTCDigest tag. It's just wasted space.
You can delete the IPTCDigest with this command
exiftoool -IPTCDigest= /path/to/files/
SG edit: Since this is a post that I often link to, I will occasionally edit it if I feel it needs updating or to clarify points.
†. Irfanview finally added read only support for XMP data from some file types.