You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

121 lines
6.6 KiB

#------------------------------------------------------------------------------
# File: tiff_version.config
#
# Description: This config file contains the definition for a Composite
# TIFFVersion tag used to determine the version of a TIFF file
#
# Usage: exiftool -config tiff_version.config -tiffversion DIR
#
# Requires: ExifTool version 11.50 or later
#
# Revisions: 2019/06/06 - Bryan K. Williams (aka StarGeek) Created
# 2019/06/07 - P. Harvey added test of TIFF format types
#
# References: http://jhove.openpreservation.org/modules/tiff/#profiles
#------------------------------------------------------------------------------
# Checks if at least one the values passed are defined.
sub has_defined {
for my $i ( @_ ) {
return 1 if defined $i;
}
return 0;
}
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
TIFFVersion => {
Require => {
0 => 'FileType'
},
Desire => {
# Version 5
1 => 'EXIF:Artist', # Artist (315/0x013b)
2 => 'EXIF:ColorMap', # ColorMap (320/0x0140)
3 => 'EXIF:ModifyDate', # DateTime (306/0x0132) Called DateTime by EXIF spec, ModifyDate by exiftool
4 => 'EXIF:HostComputer', # HostComputer (316/0x013c)
5 => 'EXIF:SubfileType', # NewSubfileType (254/0x00fe) Called NewSubfileType by TIFF spec, SubfileType by exiftool
6 => 'EXIF:Predictor', # Predictor (317/0x013d)
7 => 'EXIF:PrimaryChromaticities', # PrimaryChromaticities (319/0x013f)
8 => 'EXIF:Software', # Software (305/0x0131)
9 => 'EXIF:WhitePoint', # WhitePoint (318/0x013e)
# Version 6
10 => 'EXIF:Copyright', # Copyright (33432/0x8298)
11 => 'EXIF:DotRange', # DotRange (336/0x0150)
12 => 'EXIF:ExtraSamples', # ExtraSamples (338/0x0152)
13 => 'EXIF:HalftoneHints', # HalftoneHints (321/0x0141)
14 => 'EXIF:InkNames', # InkNames (333/0x014d)
15 => 'EXIF:InkSet', # InkSet (332/0x014c)
16 => 'EXIF:JPEGACTables', # JPEGACTables (521/0x0209)
17 => 'EXIF:JPEGDCTables', # JPEGDCTables (520/0x0208)
18 => 'EXIF:ThumbnailOffset', # JPEGInterchangeFormat (513/0x0201)
19 => 'EXIF:ThumbnailLength ', # JPEGInterchangeFormatLength (514/0x0202)
20 => 'EXIF:JPEGLosslessPredictors', # JPEGLosslessPredictors (517/0x0205)
21 => 'EXIF:JPEGPointTransforms', # JPEGPointTransforms (518/0x0206)
22 => 'EXIF:JPEGProc', # JPEGProc (512/0x0200)
23 => 'EXIF:JPEGRestartInterval', # JPEGRestartInterval (515/0x0203)
24 => 'EXIF:JPEGQTables', # JPEGQTables (519/0x0207)
25 => 'EXIF:NumberofInks', # NumberOfInks (334/0x014e)
26 => 'EXIF:ReferenceBlackWhite', # ReferenceBlackWhite (532/0x0214)
27 => 'EXIF:SampleFormat', # SampleFormat (339/0x0153)
28 => 'EXIF:SMinSampleValue', # SMinSampleValue (340/0x0154)
29 => 'EXIF:SMaxSampleValue', # SMaxSampleValue (341/0x0155)
30 => 'EXIF:TargetPrinter', # TargetPrinter (337/0x0151)
31 => 'EXIF:TileLength', # TileLength (323/0x0143)
32 => 'EXIF:TileOffsets', # TileOffsets (324/0x0144)
33 => 'EXIF:TileWidth', # TileWidth (322/0x0142)
34 => 'EXIF:TileByteCounts', # TileByteCounts (325/0x0145)
35 => 'EXIF:TransferRange', # TransferRange (342/0x0156)
36 => 'EXIF:YCbCrCoefficients', # YCbCrCoefficients (529/0x0211)
37 => 'EXIF:YCbCrPositioning', # YCbCrPositioning (531/0x0213)
38 => 'EXIF:YCbCrSubSampling', # YCbCrSubSampling (530/0x0212)
# Other tags to check
39 => 'EXIF:PhotometricInterpretation', # PhotometricInterpretation (262/0x0106)
40 => 'EXIF:Compression', # Compression (259/0x0103)
},
ValueConv => q{
if ($val[0] ne 'TIFF') {
return undef;
}
unless ($$self{SaveFormat}) {
return '<you must use the API SaveFormat option and ExifTool 11.50 or later>';
}
foreach (qw(int8s undef int16s int32s rational64s float double)) {
return '6.0' if $$self{SaveFormat}{$_};
}
if ( $val[39]=~/^(?:C(?:IELab|MYK)|YCbCr)$/ or $val[40] eq 'JPEG (old-style)' or has_defined(@val[10..38]) ) {
return '6.0';
}
if ($val[39]=~/^(?:Transparency Mask|RGB Palette)$/ or $val[40] eq 'LZW' or has_defined(@val[1..9]) ) {
return '5.0';
}
return '4.0';
},
},
},
);
# A couple of shortcuts to test for the existence of certain tags
%Image::ExifTool::UserDefined::Shortcuts = (
TiffVersion5Tags => [
'EXIF:Artist', 'EXIF:ColorMap', 'EXIF:ModifyDate', 'EXIF:HostComputer', 'EXIF:SubfileType',
'EXIF:Predictor', 'EXIF:PrimaryChromaticities', 'EXIF:Software', 'EXIF:WhitePoint',
],
TiffVersion6Tags => [
'EXIF:Copyright', 'EXIF:DotRange', 'EXIF:ExtraSamples', 'EXIF:HalftoneHints',
'EXIF:InkNames', 'EXIF:InkSet', 'EXIF:JPEGACTables', 'EXIF:JPEGDCTables',
'EXIF:ThumbnailOffset', 'EXIF:ThumbnailLength ', 'EXIF:JPEGLosslessPredictors',
'EXIF:JPEGPointTransforms', 'EXIF:JPEGProc', 'EXIF:JPEGRestartInterval',
'EXIF:JPEGQTables', 'EXIF:NumberofInks', 'EXIF:ReferenceBlackWhite', 'EXIF:SampleFormat',
'EXIF:SMinSampleValue', 'EXIF:SMaxSampleValue', 'EXIF:TargetPrinter', 'EXIF:TileLength',
'EXIF:TileOffsets', 'EXIF:TileWidth', 'EXIF:TileByteCounts', 'EXIF:TransferRange',
'EXIF:YCbCrCoefficients', 'EXIF:YCbCrPositioning', 'EXIF:YCbCrSubSampling',
],
);
# Must set undocumented SaveFormat option to provide access to the tag format types
%Image::ExifTool::UserDefined::Options = (
SaveFormat => 1,
);
1; #end