| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 2 | "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> |
| 3 | <html> |
| 4 | <head><title>example.config</title> |
| 5 | <link rel=stylesheet type='text/css' href='style.css' title='Style'> |
| 6 | </head> |
| 7 | <body> |
| 8 | <pre> |
| 9 | <span class=com>#------------------------------------------------------------------------------ |
| 10 | # File: example.config --> ~/.ExifTool_config |
| 11 | # |
| 12 | # Description: Example user configuration file for Image::ExifTool |
| 13 | # |
| 14 | # Notes: This example file shows how to define your own shortcuts and |
| 15 | # add new EXIF, IPTC, XMP, PNG, MIE and Composite tags, as well |
| 16 | # as how to specify preferred lenses for the LensID tag, and |
| 17 | # define new file types and default ExifTool API options and |
| 18 | # command-line arguments. |
| 19 | # |
| 20 | # Note that unknown tags may be extracted even if they aren't |
| 21 | # defined, but tags must be defined to be written. Also note |
| 22 | # that it is possible to override an existing tag definition |
| 23 | # with a user-defined tag. |
| 24 | # |
| 25 | # To activate this file, rename it to ".ExifTool_config" and |
| 26 | # place it in your home directory or the exiftool application |
| 27 | # directory. (On Mac and some Windows systems this must be done |
| 28 | # via the command line since the GUI's may not allow filenames to |
| 29 | # begin with a dot. Use the "rename" command in Windows or "mv" |
| 30 | # on the Mac.) This causes ExifTool to automatically load the |
| 31 | # file when run. Your home directory is determined by the first |
| 32 | # defined of the following environment variables: |
| 33 | # |
| 34 | # 1. EXIFTOOL_HOME |
| 35 | # 2. HOME |
| 36 | # 3. HOMEDRIVE + HOMEPATH |
| 37 | # 4. (the current directory) |
| 38 | # |
| 39 | # Alternatively, the -config option of the exiftool application |
| 40 | # may be used to load a specific configuration file (note that |
| 41 | # this must be the first option on the command line): |
| 42 | # |
| 43 | # exiftool -config example.config ... |
| 44 | # |
| 45 | # This example file defines the following 16 new tags as well as |
| 46 | # a number of Shortcut and Composite tags: |
| 47 | # |
| 48 | # 1. EXIF:NewEXIFTag |
| 49 | # 2. GPS:GPSPitch |
| 50 | # 3. GPS:GPSRoll |
| 51 | # 4. IPTC:NewIPTCTag |
| 52 | # 5. XMP-xmp:NewXMPxmpTag |
| 53 | # 6. XMP-exif:GPSPitch |
| 54 | # 7. XMP-exif:GPSRoll |
| 55 | # 8. XMP-xxx:NewXMPxxxTag1 |
| 56 | # 9. XMP-xxx:NewXMPxxxTag2 |
| 57 | # 10. XMP-xxx:NewXMPxxxTag3 |
| 58 | # 11. XMP-xxx:NewXMPxxxStruct |
| 59 | # 12. PNG:NewPngTag1 |
| 60 | # 13. PNG:NewPngTag2 |
| 61 | # 14. PNG:NewPngTag3 |
| 62 | # 15. MIE-Meta:NewMieTag1 |
| 63 | # 16. MIE-Test:NewMieTag2 |
| 64 | # |
| 65 | # For detailed information on the definition of tag tables and |
| 66 | # tag information hashes, see lib/Image/ExifTool/README. |
| 67 | #------------------------------------------------------------------------------ |
| 68 | |
| 69 | <a name='Shortcuts'># Shortcut tags are used when extracting information to simplify |
| 70 | # commonly used commands. They can be used to represent groups |
| 71 | # of tags, or to provide an alias for a tag name.</a></span> |
| 72 | %Image::ExifTool::UserDefined::Shortcuts = ( |
| 73 | MyShortcut => ['exif:createdate','exposuretime','aperture'], |
| 74 | MyAlias => 'FocalLengthIn35mmFormat', |
| 75 | ); |
| 76 | |
| 77 | <span class=com># NOTE: All tag names used in the following tables are case sensitive. |
| 78 | |
| 79 | <a name='UserDefined'># The %Image::ExifTool::UserDefined hash defines new tags to be added |
| 80 | # to existing tables.</a></span> |
| 81 | %Image::ExifTool::UserDefined = ( |
| 82 | <span class=com># All EXIF tags but GPS are added to the Main table, and WriteGroup is |
| 83 | # used to specify where the tag is written (defaulting to ExifIFD). Note |
| 84 | # that when reading custom EXIF tags, the same config file must be used |
| 85 | # to be able to see them with the given names. Without the config file |
| 86 | # they may only be seen as unknown tags with the -u option.</span> |
| 87 | 'Image::ExifTool::Exif::Main' => { |
| 88 | <span class=com># Example 1. EXIF:NewEXIFTag</span> |
| 89 | 0xd000 => { |
| 90 | Name => 'NewEXIFTag', |
| 91 | Writable => 'int16u', |
| 92 | WriteGroup => 'IFD0', |
| 93 | }, |
| 94 | <span class=com># add more user-defined EXIF tags here...</span> |
| 95 | }, |
| 96 | <span class=com># the <a href="geotag.html">Geotag feature</a> writes GPSPitch and GPSRoll tags, but these |
| 97 | # aren't standard EXIF so we define custom tags here:</span> |
| 98 | 'Image::ExifTool::GPS::Main' => { |
| 99 | <span class=com># Example 2. GPS:GPSPitch</span> |
| 100 | 0xd000 => { |
| 101 | Name => 'GPSPitch', |
| 102 | Writable => 'rational64s', |
| 103 | }, |
| 104 | <span class=com># Example 3. GPS:GPSRoll</span> |
| 105 | 0xd001 => { |
| 106 | Name => 'GPSRoll', |
| 107 | Writable => 'rational64s', |
| 108 | }, |
| 109 | }, |
| 110 | <span class=com># IPTC tags are added to a specific record type (eg. application record): |
| 111 | # (Note: IPTC tag ID's are limited to the range 0-255)</span> |
| 112 | 'Image::ExifTool::IPTC::ApplicationRecord' => { |
| 113 | <span class=com># Example 4. IPTC:NewIPTCTag</span> |
| 114 | 160 => { |
| 115 | Name => 'NewIPTCTag', |
| 116 | Format => 'string[0,16]', |
| 117 | }, |
| 118 | <span class=com># add more user-defined IPTC ApplicationRecord tags here...</span> |
| 119 | }, |
| 120 | <span class=com># XMP tags may be added to existing namespaces:</span> |
| 121 | 'Image::ExifTool::XMP::xmp' => { |
| 122 | <span class=com># Example 5. XMP-xmp:NewXMPxmpTag</span> |
| 123 | NewXMPxmpTag => { Groups => { 2 => 'Author' } }, |
| 124 | <span class=com># add more user-defined XMP-xmp tags here...</span> |
| 125 | }, |
| 126 | <span class=com># special Geotag tags for XMP-exif:</span> |
| 127 | 'Image::ExifTool::XMP::exif' => { |
| 128 | <span class=com># Example 6. XMP-exif:GPSPitch</span> |
| 129 | GPSPitch => { Writable => 'rational', Groups => { 2 => 'Location' } }, |
| 130 | <span class=com># Example 7. XMP-exif:GPSRoll</span> |
| 131 | GPSRoll => { Writable => 'rational', Groups => { 2 => 'Location' } }, |
| 132 | }, |
| 133 | <span class=com># new XMP namespaces (eg. xxx) must be added to the Main XMP table:</span> |
| 134 | 'Image::ExifTool::XMP::Main' => { |
| 135 | <span class=com># namespace definition for examples 8 to 11</span> |
| 136 | xxx => { <span class=com># <-- must be the same as the NAMESPACE prefix</span> |
| 137 | SubDirectory => { |
| 138 | TagTable => 'Image::ExifTool::UserDefined::xxx', |
| 139 | <span class=com># (see the definition of this table below)</span> |
| 140 | }, |
| 141 | }, |
| 142 | <span class=com># add more user-defined XMP namespaces here...</span> |
| 143 | }, |
| 144 | <span class=com># new PNG tags are added to the PNG::TextualData table:</span> |
| 145 | 'Image::ExifTool::PNG::TextualData' => { |
| 146 | <span class=com># Example 12. PNG:NewPngTag1</span> |
| 147 | NewPngTag1 => { }, |
| 148 | <span class=com># Example 13. PNG:NewPngTag2</span> |
| 149 | NewPngTag2 => { iTXt => 1 }, <span class=com># (force this tag to be written as iTXt)</span> |
| 150 | <span class=com># Example 14. PNG:NewPngTag3</span> |
| 151 | NewPngTag3 => { }, |
| 152 | }, |
| 153 | <span class=com># add a new MIE tag (NewMieTag1) and group (MIE-Test) to MIE-Meta |
| 154 | # (Note: MIE group names must NOT end with a number)</span> |
| 155 | 'Image::ExifTool::MIE::Meta' => { |
| 156 | <span class=com># Example 15. MIE-Meta:NewMieTag1</span> |
| 157 | NewMieTag1 => { |
| 158 | Writable => 'rational64u', |
| 159 | Units => [ 'cm', 'in' ], |
| 160 | }, |
| 161 | <span class=com># new MIE "Test" group for example 16</span> |
| 162 | Test => { |
| 163 | SubDirectory => { |
| 164 | TagTable => 'Image::ExifTool::UserDefined::MIETest', |
| 165 | DirName => 'MIE-Test', |
| 166 | }, |
| 167 | }, |
| 168 | }, |
| 169 | <span class=com># Composite tags are added to the Composite table:</span> |
| 170 | 'Image::ExifTool::Composite' => { |
| 171 | <span class=com># Composite tags have values that are derived from the values of |
| 172 | # other tags. The Require/Desire elements below specify constituent |
| 173 | # tags that must/may exist, and the keys of these hashes are used as |
| 174 | # indices in the @val array of the ValueConv expression to access the |
| 175 | # numerical (-n) values of these tags. Print-converted values are |
| 176 | # accessed via the @prt array. All Require'd tags must exist for |
| 177 | # the Composite tag to be evaluated. If no Require'd tags are |
| 178 | # specified, then at least one of the Desire'd tags must exist. See |
| 179 | # the Composite table in Image::ExifTool::Exif for more examples, |
| 180 | # and lib/Image/ExifTool/README for all of the details. |
| 181 | # The first few examples demonstrate simplifications which may be |
| 182 | # used if only one tag is Require'd or Desire'd: |
| 183 | # 1) the Require lookup may be replaced with a simple tag name |
| 184 | # 2) "$val" may be used to represent "$val[0]" in the expression</span> |
| 185 | FileExtension => { |
| 186 | Require => 'FileName', |
| 187 | ValueConv => '$val=~/\.([^.]*)$/; $1', |
| 188 | }, |
| 189 | <span class=com># override CircleOfConfusion tag to use D/1750 instead of D/1440</span> |
| 190 | CircleOfConfusion => { |
| 191 | Require => 'ScaleFactor35efl', |
| 192 | Groups => { 2 => 'Camera' }, |
| 193 | ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)', |
| 194 | <span class=com># an optional PrintConv may be used to format the value</span> |
| 195 | PrintConv => 'sprintf("%.3f mm",$val)', |
| 196 | }, |
| 197 | <span class=com># generate a description for this file type</span> |
| 198 | FileTypeDescription => { |
| 199 | Require => 'FileType', |
| 200 | ValueConv => 'GetFileType($val,1) || $val', |
| 201 | }, |
| 202 | <span class=com># calculate physical image size based on resolution</span> |
| 203 | PhysicalImageSize => { |
| 204 | Require => { |
| 205 | 0 => 'ImageWidth', |
| 206 | 1 => 'ImageHeight', |
| 207 | 2 => 'XResolution', |
| 208 | 3 => 'YResolution', |
| 209 | 4 => 'ResolutionUnit', |
| 210 | }, |
| 211 | ValueConv => '$val[0]/$val[2] . " " . $val[1]/$val[3]', |
| 212 | <span class=com># (the @prt array contains print-formatted values)</span> |
| 213 | PrintConv => 'sprintf("%.1fx%.1f $prt[4]", split(" ",$val))', |
| 214 | }, |
| 215 | <span class=com># [advanced] select largest JPEG preview image</span> |
| 216 | BigImage => { |
| 217 | Groups => { 2 => 'Preview' }, |
| 218 | Desire => { |
| 219 | 0 => 'JpgFromRaw', |
| 220 | 1 => 'PreviewImage', |
| 221 | 2 => 'OtherImage', |
| 222 | <span class=com># (DNG and A100 ARW may be have 2 PreviewImage's)</span> |
| 223 | 3 => 'PreviewImage (1)', |
| 224 | <span class=com># (if the MPF has 2 previews, MPImage3 could be the larger one)</span> |
| 225 | 4 => 'MPImage3', |
| 226 | 5 => 'JpgFromRaw2', # in RW2 from newer Panasonic models |
| 227 | }, |
| 228 | <span class=com># ValueConv may also be a code reference |
| 229 | # Inputs: 0) reference to list of values, 1) ExifTool object</span> |
| 230 | ValueConv => sub { |
| 231 | my $val = shift; |
| 232 | my ($image, $bigImage, $len, $bigLen); |
| 233 | foreach $image (@$val) { |
| 234 | next unless ref $image eq 'SCALAR'; |
| 235 | <span class=com># check for JPEG image (or "Binary data" if -b not used)</span> |
| 236 | next unless $$image =~ /^(\xff\xd8\xff|Binary data (\d+))/; |
| 237 | $len = $2 || length $$image; <span class=com># get image length</span> |
| 238 | <span class=com># save largest image</span> |
| 239 | next if defined $bigLen and $bigLen >= $len; |
| 240 | $bigLen = $len; |
| 241 | $bigImage = $image; |
| 242 | } |
| 243 | return $bigImage; |
| 244 | }, |
| 245 | }, |
| 246 | <span class=com># **** ADD ADDITIONAL COMPOSITE TAG DEFINITIONS HERE ****</span> |
| 247 | }, |
| 248 | ); |
| 249 | |
| 250 | <a name='xmp-xxx'><span class=com># This is a basic example of the definition for a new XMP namespace. |
| 251 | # This table is referenced through a SubDirectory tag definition |
| 252 | # in the %Image::ExifTool::UserDefined definition above. |
| 253 | # The namespace prefix for these tags is 'xxx', which corresponds to |
| 254 | # an ExifTool family 1 group name of 'XMP-xxx'.</span></a> |
| 255 | %Image::ExifTool::UserDefined::xxx = ( |
| 256 | GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' }, |
| 257 | NAMESPACE => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' }, |
| 258 | WRITABLE => 'string', <span class=com># (default to string-type tags)</span> |
| 259 | <span class=com># Example 8. XMP-xxx:NewXMPxxxTag1 (an alternate-language tag)</span> |
| 260 | <span class=com># - replace "NewXMPxxxTag1" with your own tag name (eg. "MyTag")</span> |
| 261 | NewXMPxxxTag1 => { Writable => 'lang-alt' }, |
| 262 | <span class=com># Example 9. XMP-xxx:NewXMPxxxTag2 (a string tag in the Author category)</span> |
| 263 | NewXMPxxxTag2 => { Groups => { 2 => 'Author' } }, |
| 264 | <span class=com># Example 10. XMP-xxx:NewXMPxxxTag3 (an unordered List-type tag)</span> |
| 265 | NewXMPxxxTag3 => { List => 'Bag' }, |
| 266 | <span class=com># Example 11. XMP-xxx:NewXMPxxxStruct (a structured tag)</span> |
| 267 | <span class=com># - example structured XMP tag</span> |
| 268 | NewXMPxxxStruct => { |
| 269 | <span class=com># the "Struct" entry defines the structure fields</span> |
| 270 | Struct => { |
| 271 | <span class=com># optional namespace prefix and URI for structure fields |
| 272 | # (required only if different than NAMESPACE above) |
| 273 | # --> multiple entries may exist in this namespace lookup, |
| 274 | # with the last one alphabetically being the default for |
| 275 | # the fields, but each field may have a "Namespace" |
| 276 | # element to specify which prefix to use</span> |
| 277 | NAMESPACE => { 'test' => 'http://x.y.z/test/' }, |
| 278 | <span class=com># optional structure name (used for warning messages only)</span> |
| 279 | STRUCT_NAME => 'MyStruct', |
| 280 | <span class=com># optional rdf:type property for the structure</span> |
| 281 | TYPE => 'http://x.y.z/test/xystruct', |
| 282 | <span class=com># structure field definitions (very similar to tag definitions)</span> |
| 283 | X => { Writable => 'integer' }, |
| 284 | Y => { Writable => 'integer' }, |
| 285 | <span class=com># a nested structure...</span> |
| 286 | Things => { |
| 287 | List => 'Bag', |
| 288 | Struct => { |
| 289 | NAMESPACE => { thing => 'http://x.y.z/thing/' }, |
| 290 | What => { }, |
| 291 | Where => { }, |
| 292 | }, |
| 293 | }, |
| 294 | }, |
| 295 | List => 'Seq', <span class=com># structures may also be elements of a list</span> |
| 296 | }, |
| 297 | <span class=com> # Each field in the structure has a corresponding flattened tag that is |
| 298 | # generated automatically with an ID made from a concatenation of the |
| 299 | # original structure tag ID and the field name (after capitalizing the |
| 300 | # first letter of the field name if necessary). The Name and/or |
| 301 | # Description of these flattened tags may be changed if desired, but all |
| 302 | # other tag properties are taken from the structure field definition. |
| 303 | # The "Flat" flag must be used when setting the Name or Description of a |
| 304 | # flattened tag. For example:</span> |
| 305 | NewXMPxxxStructX => { Name => 'SomeOtherName', Flat => 1 }, |
| 306 | ); |
| 307 | |
| 308 | <span class=com># the namespace may be registered so ExifTool generates the expected family 1 |
| 309 | # group names when reading if the UserDefined namespace uses a different prefix</span> |
| 310 | require Image::ExifTool::XMP; |
| 311 | Image::ExifTool::XMP::RegisterNamespace(\%Image::ExifTool::UserDefined::xxx); |
| 312 | |
| 313 | <a name='MIE'><span class=com># Adding a new MIE group requires a few extra definitions</span></a> |
| 314 | use Image::ExifTool::MIE; |
| 315 | %Image::ExifTool::UserDefined::MIETest = ( |
| 316 | %Image::ExifTool::MIE::tableDefaults, <span class=com># default MIE table entries</span> |
| 317 | GROUPS => { 0 => 'MIE', 1 => 'MIE-Test', 2 => 'Document' }, |
| 318 | WRITE_GROUP => 'MIE-Test', |
| 319 | <span class=com># Example 16. MIE-Test:NewMieTag2</span> |
| 320 | NewMieTag2 => { }, <span class=com># new user-defined tag in MIE-Test group</span> |
| 321 | ); |
| 322 | |
| 323 | <a name='Lenses'><span class=com># A special 'Lenses' list can be defined to give priority to specific lenses |
| 324 | # in the logic to determine a lens model for the Composite:LensID tag</span></a> |
| 325 | @Image::ExifTool::UserDefined::Lenses = ( |
| 326 | 'Sigma AF 10-20mm F4-5.6 EX DC', |
| 327 | 'Tokina AF193-2 19-35mm f/3.5-4.5', |
| 328 | ); |
| 329 | |
| 330 | <a name='FileTypes'><span class=com># User-defined file types to recognize</span></a> |
| 331 | %Image::ExifTool::UserDefined::FileTypes = ( |
| 332 | XXX => { <span class=com># <-- the extension of the new file type (case insensitive)</span> |
| 333 | <span class=com># BaseType specifies the format upon which this file is based (case |
| 334 | # sensitive). If BaseType is defined, then the file will be fully |
| 335 | # supported, and in this case the Magic pattern should not be defined</span> |
| 336 | BaseType => 'TIFF', |
| 337 | MIMEType => 'image/x-xxx', |
| 338 | Description => 'My XXX file type', |
| 339 | <span class=com># if the BaseType is writable by ExifTool, then the new file type |
| 340 | # will also be writable unless otherwise specified, like this:</span> |
| 341 | Writable => 0, |
| 342 | }, |
| 343 | YYY => { |
| 344 | <span class=com># without BaseType, the file will be recognized but not supported</span> |
| 345 | Magic => '0123abcd', <span class=com># regular expression to match at start of file</span> |
| 346 | MIMEType => 'application/test', |
| 347 | Description => 'My YYY file type', |
| 348 | }, |
| 349 | ZZZ => { |
| 350 | <span class=com># if neither BaseType nor Magic are defined, the file will be |
| 351 | # recognized by extension only. MIMEType will be application/unknown |
| 352 | # unless otherwise specified</span> |
| 353 | Description => 'My ZZZ file type', |
| 354 | }, |
| 355 | <span class=com># if only BaseType is specified, then the following simplified syntax |
| 356 | # may be used. In this example, files with extension "TTT" will be |
| 357 | # processed as JPEG files</span> |
| 358 | TTT => 'JPEG', |
| 359 | ); |
| 360 | |
| 361 | <a name='PREF'><span class=com># Change default location for writing QuickTime tags so Keys is preferred |
| 362 | # (by default, the PREFERRED levels are: ItemList=2, UserData=1, Keys=0)</span></a> |
| 363 | use Image::ExifTool::QuickTime; |
| 364 | $Image::ExifTool::QuickTime::Keys{PREFERRED} = 3; |
| 365 | |
| 366 | <span class=com># Specify default ExifTool API options |
| 367 | # (see the <a href="ExifTool.html#Options">Options function documentation</a> for available options)</span> |
| 368 | %Image::ExifTool::UserDefined::Options = ( |
| 369 | CoordFormat => '%.6f', <span class=com># change default GPS coordinate format</span> |
| 370 | Duplicates => 1, <span class=com># make -a default for the exiftool app</span> |
| 371 | GeoMaxHDOP => 4, <span class=com># ignore GPS fixes with HDOP > 4</span> |
| 372 | RequestAll => 3, <span class=com># request additional tags not normally generated</span> |
| 373 | ); |
| 374 | |
| 375 | <span class=com># Specify default exiftool command-line arguments |
| 376 | # - inserted before all other options except -config |
| 377 | # - applies to all -execute'd commands</span> |
| 378 | @Image::ExifTool::UserDefined::Arguments = ( |
| 379 | '-i', 'HIDDEN', <span class=com># ignore hidden files by default (names beginning with ".")</span> |
| 380 | ); |
| 381 | |
| 382 | <span class=com># Add user-defined cities to the Geolocation lookup</span> |
| 383 | @Image::ExifTool::UserDefined::Geolocation = ( |
| 384 | <span class=com># (city,region,subregion,country_code,country,timezone,feature_code,population,lat,lon)</span> |
| 385 | ['Sinemorets','Burgas','Obshtina Tsarevo','BG','','Europe/Sofia','PPL',400,42.06115,27.97833], |
| 386 | ); |
| 387 | |
| 388 | <span class=com>#------------------------------------------------------------------------------</span> |
| 389 | 1; <span class=com>#end</span> |
| 390 | </pre> |
| 391 | <hr> |
| 392 | <p class='lf'># <a href="index.html"><-- Back to ExifTool home page</a></p> |
| 393 | </body> |
| 394 | </html> |