summaryrefslogtreecommitdiff
path: root/lib/Image/ExifTool.pm
diff options
context:
space:
mode:
authorexiftool <exiftool@users.sourceforge.net>2023-08-10 13:03:56 -0400
committerexiftool <exiftool@users.sourceforge.net>2023-08-10 13:03:56 -0400
commitc5d5eae9fb6924ee859f4b62b5472e242cfb7662 (patch)
tree85263c3111b13add28e5c8ed8cded72e470ebe2b /lib/Image/ExifTool.pm
parentd35e9e26e0a8b443dae307f55d0a4a067d311a16 (diff)
Update to 12.65
Diffstat (limited to 'lib/Image/ExifTool.pm')
-rw-r--r--lib/Image/ExifTool.pm204
1 files changed, 112 insertions, 92 deletions
diff --git a/lib/Image/ExifTool.pm b/lib/Image/ExifTool.pm
index 753dfeda..e22e73c5 100644
--- a/lib/Image/ExifTool.pm
+++ b/lib/Image/ExifTool.pm
@@ -29,7 +29,7 @@ use vars qw($VERSION $RELEASE @ISA @EXPORT_OK %EXPORT_TAGS $AUTOLOAD @fileTypes
%jpegMarker %specialTags %fileTypeLookup $testLen $exeDir
%static_vars);
-$VERSION = '12.64';
+$VERSION = '12.65';
$RELEASE = '';
@ISA = qw(Exporter);
%EXPORT_TAGS = (
@@ -126,7 +126,7 @@ sub MakeTiffHeader($$$$;$$);
sub SplitFileName($);
sub EncodeFileName($$;$);
sub Open($*$;$);
-sub Exists($$);
+sub Exists($$;$);
sub IsDirectory($$);
sub Rename($$$);
sub Unlink($@);
@@ -1052,6 +1052,93 @@ my %xmpShorthandOpt = ( 0 => 'None', 1 => 'Shorthand', 2 => ['Shorthand','OneDes
maccroatian => 'MacCroatian', cp10082 => 'MacCroatian',
);
+# list of available options
+# +-----------------------------------------------------+
+# ! DON'T FORGET!! When adding any new option, must !
+# ! decide how it is handled in SetNewValuesFromFile() !
+# +-----------------------------------------------------+
+# (Note: All options must exist in this lookup, even if undefined,
+# to facilitate case-insensitive options. 'Group#' is handled specially)
+my @availableOptions = (
+ [ 'Binary', undef, 'flag to extract binary values even if tag not specified' ],
+ [ 'ByteOrder', undef, 'default byte order when creating EXIF information' ],
+ [ 'Charset', 'UTF8', 'character set for converting Unicode characters' ],
+ [ 'CharsetEXIF', undef, 'internal EXIF "ASCII" string encoding' ],
+ [ 'CharsetFileName', undef, 'external encoding for file names' ],
+ [ 'CharsetID3', 'Latin','internal ID3v1 character set' ],
+ [ 'CharsetIPTC', 'Latin','fallback IPTC character set if no CodedCharacterSet' ],
+ [ 'CharsetPhotoshop', 'Latin','internal encoding for Photoshop resource names' ],
+ [ 'CharsetQuickTime', 'MacRoman', 'internal QuickTime string encoding' ],
+ [ 'CharsetRIFF', 0, 'internal RIFF string encoding (0=default to Latin)' ],
+ [ 'Compact', { }, 'write compact XMP' ],
+ [ 'Composite', 1, 'flag to calculate Composite tags' ],
+ [ 'Compress', undef, 'flag to write new values as compressed if possible' ],
+ [ 'CoordFormat', undef, 'GPS lat/long coordinate format' ],
+ [ 'DateFormat', undef, 'format for date/time' ],
+ [ 'Duplicates', 1, 'flag to save duplicate tag values' ],
+ [ 'Escape', undef, 'escape special characters' ],
+ [ 'Exclude', undef, 'tags to exclude' ],
+ [ 'ExtendedXMP', 1, 'strategy for reading extended XMP' ],
+ [ 'ExtractEmbedded', undef, 'flag to extract information from embedded documents' ],
+ [ 'FastScan', undef, 'flag to avoid scanning for trailer' ],
+ [ 'Filter', undef, 'output filter for all tag values' ],
+ [ 'FilterW', undef, 'input filter when writing tag values' ],
+ [ 'FixBase', undef, 'fix maker notes base offsets' ],
+ [ 'GeoMaxIntSecs', 1800, 'geotag maximum interpolation time (secs)' ],
+ [ 'GeoMaxExtSecs', 1800, 'geotag maximum extrapolation time (secs)' ],
+ [ 'GeoMaxHDOP', undef, 'geotag maximum HDOP' ],
+ [ 'GeoMaxPDOP', undef, 'geotag maximum PDOP' ],
+ [ 'GeoMinSats', undef, 'geotag minimum satellites' ],
+ [ 'GeoSpeedRef', undef, 'geotag GPSSpeedRef' ],
+ [ 'GlobalTimeShift', undef, 'apply time shift to all extracted date/time values' ],
+ [ 'Group#', undef, 'return tags for specified groups in family #' ],
+ [ 'HexTagIDs', 0, 'use hex tag ID\'s in family 7 group names' ],
+ [ 'HtmlDump', 0, 'HTML dump (0-3, higher # = bigger limit)' ],
+ [ 'HtmlDumpBase', undef, 'base address for HTML dump' ],
+ [ 'IgnoreMinorErrors',undef, 'ignore minor errors when reading/writing' ],
+ [ 'IgnoreTags', undef, 'list of tags to ignore when extracting' ],
+ [ 'ImageHashType', 'MD5', 'image hash algorithm' ],
+ [ 'Lang', $defaultLang, 'localized language for descriptions etc' ],
+ [ 'LargeFileSupport', undef, 'flag indicating support of 64-bit file offsets' ],
+ [ 'List', undef, '[deprecated, use ListSplit and ListJoin instead]' ],
+ [ 'ListItem', undef, 'used to return a specific item from lists' ],
+ [ 'ListJoin', ', ', 'join lists together with this separator' ],
+ [ 'ListSep', ', ', '[deprecated, use ListSplit and ListJoin instead]' ],
+ [ 'ListSplit', undef, 'regex for splitting list-type tag values when writing' ],
+ [ 'MakerNotes', undef, 'extract maker notes as a block' ],
+ [ 'MDItemTags', undef, 'extract MacOS metadata item tags' ],
+ [ 'MissingTagValue', undef, 'value for missing tags when expanded in expressions' ],
+ [ 'NoMultiExif', undef, 'raise error when writing multi-segment EXIF' ],
+ [ 'NoPDFList', undef, 'flag to avoid splitting PDF List-type tag values' ],
+ [ 'NoWarning', undef, 'regular expression for warnings to suppress' ],
+ [ 'Password', undef, 'password for password-protected PDF documents' ],
+ [ 'PrintConv', 1, 'flag to enable print conversion' ],
+ [ 'QuickTimeHandler', 1, 'flag to add mdir Handler to newly created Meta box' ],
+ [ 'QuickTimePad', undef, 'flag to preserve padding of QuickTime CR3 tags' ],
+ [ 'QuickTimeUTC', undef, 'assume that QuickTime date/time tags are stored as UTC' ],
+ [ 'RequestAll', undef, 'extract all tags that must be specifically requested' ],
+ [ 'RequestTags', undef, 'extra tags to request (on top of those in the tag list)' ],
+ [ 'SaveFormat', undef, 'save family 6 tag TIFF format' ],
+ [ 'SavePath', undef, 'save family 5 location path' ],
+ [ 'ScanForXMP', undef, 'flag to scan for XMP information in all files' ],
+ [ 'Sort', 'Input','order to sort found tags (Input, File, Tag, Descr, Group#)' ],
+ [ 'Sort2', 'File', 'secondary sort order for tags in a group (File, Tag, Descr)' ],
+ [ 'StrictDate', undef, 'flag to return undef for invalid date conversions' ],
+ [ 'Struct', undef, 'return structures as hash references' ],
+ [ 'StructFormat', undef, 'format for structure serialization when reading/writing' ],
+ [ 'SystemTags', undef, 'extract additional File System tags' ],
+ [ 'TextOut', \*STDOUT, 'file for Verbose/HtmlDump output' ],
+ [ 'TimeZone', undef, 'local time zone' ],
+ [ 'Unknown', 0, 'flag to get values of unknown tags (0-2)' ],
+ [ 'UserParam', { }, 'user parameters for additional user-defined tag values' ],
+ [ 'Validate', undef, 'perform additional validation' ],
+ [ 'Verbose', 0, 'print verbose messages (0-5, higher # = more verbose)' ],
+ [ 'WriteMode', 'wcg', 'enable all write modes by default' ],
+ [ 'XAttrTags', undef, 'extract MacOS extended attribute tags' ],
+ [ 'XMPAutoConv', 1, 'automatic conversion of unknown XMP tag values' ],
+ [ 'XMPShorthand', 0, '[deprecated, use Compact=Shorthand instead]' ],
+);
+
# default family 0 group priority for writing
# (NOTE: tags in groups not specified here will not be written unless
# overridden by the module or specified when writing)
@@ -2368,92 +2455,11 @@ sub ClearOptions($)
local $_;
my $self = shift;
- # create options hash with default values
- # +-----------------------------------------------------+
- # ! DON'T FORGET!! When adding any new option, must !
- # ! decide how it is handled in SetNewValuesFromFile() !
- # +-----------------------------------------------------+
- # (Note: All options must exist in this lookup, even if undefined,
- # to facilitate case-insensitive options. 'Group#' is handled specially)
- $$self{OPTIONS} = {
- Binary => undef, # flag to extract binary values even if tag not specified
- ByteOrder => undef, # default byte order when creating EXIF information
- Charset => 'UTF8', # character set for converting Unicode characters
- CharsetEXIF => undef, # internal EXIF "ASCII" string encoding
- CharsetFileName => undef, # external encoding for file names
- CharsetID3 => 'Latin', # internal ID3v1 character set
- CharsetIPTC => 'Latin', # fallback IPTC character set if no CodedCharacterSet
- CharsetPhotoshop => 'Latin', # internal encoding for Photoshop resource names
- CharsetQuickTime => 'MacRoman', # internal QuickTime string encoding
- CharsetRIFF => 0, # internal RIFF string encoding (0=default to Latin)
- Compact => { }, # write compact XMP
- Composite => 1, # flag to calculate Composite tags
- Compress => undef, # flag to write new values as compressed if possible
- CoordFormat => undef, # GPS lat/long coordinate format
- DateFormat => undef, # format for date/time
- Duplicates => 1, # flag to save duplicate tag values
- Escape => undef, # escape special characters
- Exclude => undef, # tags to exclude
- ExtendedXMP => 1, # strategy for reading extended XMP
- ExtractEmbedded =>undef,# flag to extract information from embedded documents
- FastScan => undef, # flag to avoid scanning for trailer
- Filter => undef, # output filter for all tag values
- FilterW => undef, # input filter when writing tag values
- FixBase => undef, # fix maker notes base offsets
- GeoMaxIntSecs => 1800, # geotag maximum interpolation time (secs)
- GeoMaxExtSecs => 1800, # geotag maximum extrapolation time (secs)
- GeoMaxHDOP => undef, # geotag maximum HDOP
- GeoMaxPDOP => undef, # geotag maximum PDOP
- GeoMinSats => undef, # geotag minimum satellites
- GeoSpeedRef => undef, # geotag GPSSpeedRef
- GlobalTimeShift => undef, # apply time shift to all extracted date/time values
- # Group# => undef, # return tags for specified groups in family #
- HexTagIDs => 0, # use hex tag ID's in family 7 group names
- HtmlDump => 0, # HTML dump (0-3, higher # = bigger limit)
- HtmlDumpBase => undef, # base address for HTML dump
- IgnoreMinorErrors => undef, # ignore minor errors when reading/writing
- IgnoreTags => undef, # list of tags to ignore when extracting
- ImageHashType => 'MD5', # image hash algorithm
- Lang => $defaultLang,# localized language for descriptions etc
- LargeFileSupport => undef, # flag indicating support of 64-bit file offsets
- List => undef, # extract lists of PrintConv values into arrays [no longer documented]
- ListItem => undef, # used to return a specific item from lists
- ListJoin => ', ', # join lists together with this separator
- ListSep => ', ', # list item separator [no longer documented]
- ListSplit => undef, # regex for splitting list-type tag values when writing
- MakerNotes => undef, # extract maker notes as a block
- MDItemTags => undef, # extract MacOS metadata item tags
- MissingTagValue =>undef,# value for missing tags when expanded in expressions
- NoMultiExif => undef, # raise error when writing multi-segment EXIF
- NoPDFList => undef, # flag to avoid splitting PDF List-type tag values
- NoWarning => undef, # regular expression for warnings to suppress
- Password => undef, # password for password-protected PDF documents
- PrintConv => 1, # flag to enable print conversion
- QuickTimeHandler => 1, # flag to add mdir Handler to newly created Meta box
- QuickTimePad=> undef, # flag to preserve padding of QuickTime CR3 tags
- QuickTimeUTC=> undef, # assume that QuickTime date/time tags are stored as UTC
- RequestAll => undef, # extract all tags that must be specifically requested
- RequestTags => undef, # extra tags to request (on top of those in the tag list)
- SaveFormat => undef, # save family 6 tag TIFF format
- SavePath => undef, # save family 5 location path
- ScanForXMP => undef, # flag to scan for XMP information in all files
- Sort => 'Input', # order to sort found tags (Input, File, Tag, Descr, Group#)
- Sort2 => 'File', # secondary sort order for tags in a group (File, Tag, Descr)
- StrictDate => undef, # flag to return undef for invalid date conversions
- Struct => undef, # return structures as hash references
- StructFormat=> undef, # format for structure serialization when reading/writing
- SystemTags => undef, # extract additional File System tags
- TextOut => \*STDOUT,# file for Verbose/HtmlDump output
- TimeZone => undef, # local time zone
- Unknown => 0, # flag to get values of unknown tags (0-2)
- UserParam => { }, # user parameters for additional user-defined tag values
- Validate => undef, # perform additional validation
- Verbose => 0, # print verbose messages (0-5, higher # = more verbose)
- WriteMode => 'wcg', # enable all write modes by default
- XAttrTags => undef, # extract MacOS extended attribute tags
- XMPAutoConv => 1, # automatic conversion of unknown XMP tag values
- XMPShorthand=> 0, # (unused, but needed for backward compatibility)
- };
+ $$self{OPTIONS} = { }; # clear all options
+
+ # load default options
+ $$self{OPTIONS}{$$_[0]} = $$_[1] foreach @availableOptions;
+
# keep necessary member variables in sync with options
delete $$self{CUR_LANG};
delete $$self{ESCAPE_PROC};
@@ -3891,6 +3897,15 @@ sub GetCompositeTagInfo($)
}
#------------------------------------------------------------------------------
+# Return List ExifTool API options
+# Returns: 0) reference to list of available options -- each entry is a list
+# [0=option name, 1=default value, 2=description]
+sub AvailableOptions()
+{
+ return \@availableOptions;
+}
+
+#------------------------------------------------------------------------------
# Get tag name (removes copy index)
# Inputs: 0) Tag key
# Returns: Tag name
@@ -4374,11 +4389,11 @@ sub Open($*$;$)
#------------------------------------------------------------------------------
# Check to see if a file exists (with Windows Unicode support)
-# Inputs: 0) ExifTool ref, 1) file name
+# Inputs: 0) ExifTool ref, 1) file name, 2) flag if we are writing this file
# Returns: true if file exists
-sub Exists($$)
+sub Exists($$;$)
{
- my ($self, $file) = @_;
+ my ($self, $file, $writing) = @_;
if ($self->EncodeFileName($file)) {
local $SIG{'__WARN__'} = \&SetWarning;
@@ -4388,10 +4403,12 @@ sub Exists($$)
Win32API::File::OPEN_EXISTING(), 0, []) };
return 0 unless $wh;
eval { Win32API::File::CloseHandle($wh) };
- } else {
+ } elsif ($writing) {
# (named pipes already exist, but we pretend that they don't
# so we will be able to write them, so test with for pipe -p)
return(-e $file and not -p $file);
+ } else {
+ return(-e $file);
}
return 1;
}
@@ -4894,6 +4911,7 @@ sub SetFoundTags($)
$groupList = [ $$options{$groupOpt} ];
}
foreach (@$groupList) {
+ next unless defined $_;
# groups have priority in order they were specified
++$wantOrder;
my ($groupName, $want);
@@ -7836,6 +7854,8 @@ sub DoProcessTIFF($$;$)
return 1;
}
}
+ } elsif ($fileType eq 'ARW') {
+ $$self{LOW_PRIORITY_DIR}{IFD1} = 1; # lower priority of IFD1 tags in ARW files
}
# we have a valid TIFF (or whatever) file
if ($fileType and not $$self{VALUE}{FileType}) {