Skip to content

Commit 11d9867

Browse files
authored
Merge pull request #43 from woss/v13.03
Update exiftool to version 13.03
2 parents 923dcf6 + 44f34c3 commit 11d9867

File tree

19 files changed

+6135
-5806
lines changed

19 files changed

+6135
-5806
lines changed

exiftool/exiftool

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use strict;
1111
use warnings;
1212
require 5.004;
1313

14-
my $version = '13.02';
14+
my $version = '13.03';
1515

1616
# add our 'lib' directory to the include list BEFORE 'use Image::ExifTool'
1717
my $exePath;
@@ -1777,7 +1777,7 @@ if ($isWriting) {
17771777
if (defined $diff) {
17781778
Error "Can't use -diff option when writing tags\n";
17791779
next;
1780-
} elsif (@tags and not $outOpt) {
1780+
} elsif (@tags and not $outOpt and not $csv) {
17811781
my ($tg, $s) = @tags > 1 ? ("$tags[0] ...", 's') : ($tags[0], '');
17821782
Warn "Ignored superfluous tag name$s or invalid option$s: -$tg\n";
17831783
}
@@ -2852,8 +2852,16 @@ TAG: foreach $tag (@foundTags) {
28522852
$$val{num} = $num if defined $num and not IsEqual($num, $$val{val});
28532853
}
28542854
my $ex = $$et{TAG_EXTRA}{$tag};
2855-
$$val{'hex'} = join ' ', unpack '(H2)*', $$ex{BinVal} if defined $$ex{BinVal};
28562855
$$val{'fmt'} = $$ex{G6} if defined $$ex{G6};
2856+
if (defined $$ex{BinVal}) {
2857+
my $max = ($$et{OPTIONS}{LimitLongValues} - 5) / 3;
2858+
if ($max >= 0 and length($$ex{BinVal}) > int($max)) {
2859+
$max = int $max;
2860+
$$val{'hex'} = join ' ', unpack("(H2)$max", $$ex{BinVal}), '[...]';
2861+
} else {
2862+
$$val{'hex'} = join ' ', unpack '(H2)*', $$ex{BinVal};
2863+
}
2864+
}
28572865
}
28582866
}
28592867
FormatJSON($fp, $val, $ind, $quote);
@@ -3148,9 +3156,15 @@ sub SetImageInfo($$$)
31483156
next unless defined $absPath and $csvInfo = $database{$absPath};
31493157
}
31503158
$found = 1;
3151-
$verbose and print $vout "Setting new values from $csv database\n";
3159+
if ($verbose) {
3160+
print $vout "Setting new values from $csv database\n";
3161+
print $vout 'Including tags: ',join(' ',@tags),"\n" if @tags;
3162+
print $vout 'Excluding tags: ',join(' ',@exclude),"\n" if @exclude;
3163+
}
31523164
foreach $tag (OrderedKeys($csvInfo)) {
31533165
next if $tag =~ /\b(SourceFile|Directory|FileName)$/i; # don't write these
3166+
next if @tags and not grep /^\Q$tag\E$/i, @tags;
3167+
next if @exclude and grep /^\Q$tag\E$/i, @exclude;
31543168
my ($rtn, $wrn) = $et->SetNewValue($tag, $$csvInfo{$tag},
31553169
Protected => 1, AddValue => $csvAdd,
31563170
ProtectSaved => $csvSaveCount);
@@ -5143,7 +5157,7 @@ information. Use the B<-s> option to see the tag names instead.
51435157
=item B<-->I<TAG>
51445158
51455159
Exclude specified tag from extracted information. Same as the B<-x> option.
5146-
Group names and wildcards are permitted as described above for B<-TAG>.
5160+
Group names and wildcards are permitted as described above for B<->I<TAG>.
51475161
Once excluded from the output, a tag may not be re-included by a subsequent
51485162
option. May also be used following a B<-tagsFromFile> option to exclude
51495163
tags from being copied (when redirecting to another tag, it is the source
@@ -5574,7 +5588,9 @@ deleted). Also, FileName and Directory columns are ignored if they exist
55745588
all other columns are imported. To force a tag to be deleted, use the B<-f>
55755589
option and set the value to "-" in the CSV file (or to the MissingTagValue
55765590
if this API option was used). Multiple databases may be imported in a
5577-
single command.
5591+
single command. Specific tags may be imported from the database by adding
5592+
B<->I<TAG> options to the command, or excluded with B<-->I<TAG> options.
5593+
If no tags are specified, then all except FileName and Directory are used.
55785594
55795595
When exporting a CSV file, the B<-g> or B<-G> option adds group names to the
55805596
tag headings. If the B<-a> option is used to allow duplicate tag names, the
@@ -5710,19 +5726,28 @@ preserved with the B<-struct> option (this also causes all list-type XMP
57105726
tags to be output as JSON arrays, otherwise single-item lists would be
57115727
output as simple strings). The B<-a> option is implied when B<-json> is
57125728
used, but entries with identical JSON names are suppressed in the output.
5713-
(B<-G4> may be used to ensure that all tags have unique JSON names.) Adding
5714-
the B<-D> or B<-H> option changes tag values to JSON objects with "val" and
5715-
"id" fields. Adding B<-l> adds a "desc" field, and a "num" field if the
5716-
numerical value is different from the converted "val", and "fmt" and "hex"
5717-
fields for EXIF metadata if the API SaveFormat and SaveBin options are set
5718-
respectively. The B<-b> option may be added to output binary data, encoded
5719-
in base64 if necessary (indicated by ASCII "base64:" as the first 7 bytes of
5720-
the value), and B<-t> may be added to include tag table information (see
5721-
B<-t> for details). The JSON output is UTF-8 regardless of any B<-L> or
5722-
B<-charset> option setting, but the UTF-8 validation is disabled if a
5723-
character set other than UTF-8 is specified. Note that ExifTool quotes JSON
5724-
values only if they don't look like numbers (regardless of the original
5725-
storage format or the relevant metadata specification).
5729+
(B<-G4> may be used to ensure that all tags have unique JSON names.)
5730+
5731+
Adding the B<-D> or B<-H> option changes tag values to JSON objects with
5732+
"val" and "id" fields. Adding B<-l> adds a "desc" field, and a "num" field
5733+
if the numerical value is different from the converted "val", and "fmt" and
5734+
"hex" fields for EXIF metadata if the API SaveFormat and SaveBin options are
5735+
set respectively, and the length of the "hex" output is limited by the API
5736+
LimitLongValues setting. The B<-b> option may be added to output binary
5737+
data, encoded in base64 if necessary (indicated by ASCII "base64:" as the
5738+
first 7 bytes of the value), and B<-t> may be added to include tag table
5739+
information (see B<-t> for details). The JSON output is UTF-8 regardless of
5740+
any B<-L> or B<-charset> option setting, but the UTF-8 validation is
5741+
disabled if a character set other than UTF-8 is specified.
5742+
5743+
Note that ExifTool quotes JSON values only if they don't look like numbers
5744+
(regardless of the original storage format or the relevant metadata
5745+
specification). This may be a problem when reading the JSON via a strongly
5746+
typed language. However, the API StructFormat option may be set to "JSONQ"
5747+
to force quoting of numbers. As well, the B<-sep> option may be used to
5748+
convert arrays into strings. For example:
5749+
5750+
exiftool -j -api structformat=jsonq -sep ", " ...
57265751
57275752
If I<JSONFILE> is specified, the file is imported and the tag definitions
57285753
from the file are used to set tag values on a per-file basis. The special
@@ -5735,7 +5760,9 @@ that options exporting JSON objects instead of simple values are not
57355760
compatible with the import file format (ie. export with B<-D>, B<-H>, B<-l>,
57365761
or B<-T> is not compatible, and use B<-G> instead of B<-g>). Additionally,
57375762
tag names in the input JSON file may be suffixed with a C<#> to disable
5738-
print conversion.
5763+
print conversion. Specific tags may be imported from the database by adding
5764+
B<->I<TAG> options to the command, or excluded with B<-->I<TAG> options.
5765+
If no tags are specified, then all except FileName and Directory are used.
57395766
57405767
Unlike CSV import, empty values are not ignored, and will cause an empty
57415768
value to be written if supported by the specific metadata type. Tags are
@@ -5876,7 +5903,7 @@ with this command:
58765903
58775904
produces output like this:
58785905
5879-
-- Generated by ExifTool 13.02 --
5906+
-- Generated by ExifTool 13.03 --
58805907
File: a.jpg - 2003:10:31 15:44:19
58815908
(f/5.6, 1/60s, ISO 100)
58825909
File: b.jpg - 2006:05:23 11:57:38
@@ -6305,7 +6332,8 @@ ExifTool will not scan to the end of a JPEG image to check for an AFCP or
63056332
PreviewImage trailer, or past the first comment in GIF images or the
63066333
audio/video data in WAV/AVI files to search for additional metadata. These
63076334
speed benefits are small when reading images directly from disk, but can be
6308-
substantial if piping images through a network connection. For more
6335+
substantial if piping images through a network connection. Also bypasses
6336+
CRC validation when writing PNG images which can be very slow. For more
63096337
substantial speed benefits, B<-fast2> also causes exiftool to avoid
63106338
extracting any EXIF MakerNote information, and to stop processing at the
63116339
IDAT chunk of PNG images and the mdat atom of QuickTime-format files (but
@@ -6716,8 +6744,9 @@ names, even if they begin with a dash (C<->).
67166744
Compare metadata in I<FILE> with I<FILE2>. The I<FILE2> name may include
67176745
filename formatting codes (see the B<-w> option). All extracted tags from
67186746
the files are compared, but the extracted tags may be controlled by adding
6719-
B<-TAG> or B<--TAG> options. For example, below is a command to compare all
6720-
the same-named files in two different directories, ignoring the System tags:
6747+
B<->I<TAG> or B<-->I<TAG> options. For example, below is a command to
6748+
compare all the same-named files in two different directories, ignoring the
6749+
System tags:
67216750
67226751
exiftool DIR1 -diff DIR2/%f.%e --system:all
67236752

0 commit comments

Comments
 (0)