example.config 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. #------------------------------------------------------------------------------
  2. # File: ExifTool_config --> ~/.ExifTool_config
  3. #
  4. # Description: Sample user configuration file for Image::ExifTool
  5. #
  6. # Notes: This example file shows how to define your own shortcuts and
  7. # add new EXIF, IPTC, XMP, PNG, MIE and Composite tags, as well
  8. # as how to specify preferred lenses for the LensID tag, and
  9. # define new file types and default ExifTool option values.
  10. #
  11. # Note that unknown tags may be extracted even if they aren't
  12. # defined, but tags must be defined to be written. Also note
  13. # that it is possible to override an existing tag definition
  14. # with a user-defined tag.
  15. #
  16. # To activate this file, rename it to ".ExifTool_config" and
  17. # place it in your home directory or the exiftool application
  18. # directory. (On Windows and Mac systems this must be done via
  19. # the command line since the GUI's don't allow filenames to begin
  20. # with a dot. Use the "rename" command in Windows or "mv" on the
  21. # Mac.) This causes ExifTool to automatically load the file when
  22. # run. Your home directory is determined by the first defined of
  23. # the following environment variables:
  24. #
  25. # 1. EXIFTOOL_HOME
  26. # 2. HOME
  27. # 3. HOMEDRIVE + HOMEPATH
  28. # 4. (the current directory)
  29. #
  30. # Alternatively, the -config option of the exiftool application
  31. # may be used to load a specific configuration file (note that
  32. # this must be the first option on the command line):
  33. #
  34. # exiftool -config example.config ...
  35. #
  36. # This example file defines the following 16 new tags as well as
  37. # a number of Shortcut and Composite tags:
  38. #
  39. # 1. EXIF:NewEXIFTag
  40. # 2. GPS:GPSPitch
  41. # 3. GPS:GPSRoll
  42. # 4. IPTC:NewIPTCTag
  43. # 5. XMP-xmp:NewXMPxmpTag
  44. # 6. XMP-exif:GPSPitch
  45. # 7. XMP-exif:GPSRoll
  46. # 8. XMP-xxx:NewXMPxxxTag1
  47. # 9. XMP-xxx:NewXMPxxxTag2
  48. # 10. XMP-xxx:NewXMPxxxTag3
  49. # 11. XMP-xxx:NewXMPxxxStruct
  50. # 12. PNG:NewPngTag1
  51. # 13. PNG:NewPngTag2
  52. # 14. PNG:NewPngTag3
  53. # 15. MIE-Meta:NewMieTag1
  54. # 16. MIE-Test:NewMieTag2
  55. #
  56. # For detailed information on the definition of tag tables and
  57. # tag information hashes, see lib/Image/ExifTool/README.
  58. #------------------------------------------------------------------------------
  59. # Shortcut tags are used when extracting information to simplify
  60. # commonly used commands. They can be used to represent groups
  61. # of tags, or to provide an alias for a tag name.
  62. %Image::ExifTool::UserDefined::Shortcuts = (
  63. MyShortcut => ['exif:createdate','exposuretime','aperture'],
  64. MyAlias => 'FocalLengthIn35mmFormat',
  65. );
  66. # NOTE: All tag names used in the following tables are case sensitive.
  67. # The %Image::ExifTool::UserDefined hash defines new tags to be added
  68. # to existing tables.
  69. %Image::ExifTool::UserDefined = (
  70. # All EXIF tags are added to the Main table, and WriteGroup is used to
  71. # specify where the tag is written (default is ExifIFD if not specified):
  72. 'Image::ExifTool::Exif::Main' => {
  73. # Example 1. EXIF:NewEXIFTag
  74. 0xd000 => {
  75. Name => 'NewEXIFTag',
  76. Writable => 'int16u',
  77. WriteGroup => 'IFD0',
  78. },
  79. # add more user-defined EXIF tags here...
  80. },
  81. # the Geotag feature writes these additional GPS tags if available:
  82. 'Image::ExifTool::GPS::Main' => {
  83. # Example 2. GPS:GPSPitch
  84. 0xd000 => {
  85. Name => 'GPSPitch',
  86. Writable => 'rational64s',
  87. },
  88. # Example 3. GPS:GPSRoll
  89. 0xd001 => {
  90. Name => 'GPSRoll',
  91. Writable => 'rational64s',
  92. },
  93. },
  94. # IPTC tags are added to a specific record type (eg. application record):
  95. # (Note: IPTC tag ID's are limited to the range 0-255)
  96. 'Image::ExifTool::IPTC::ApplicationRecord' => {
  97. # Example 4. IPTC:NewIPTCTag
  98. 160 => {
  99. Name => 'NewIPTCTag',
  100. Format => 'string[0,16]',
  101. },
  102. # add more user-defined IPTC ApplicationRecord tags here...
  103. },
  104. # XMP tags may be added to existing namespaces:
  105. 'Image::ExifTool::XMP::xmp' => {
  106. # Example 5. XMP-xmp:NewXMPxmpTag
  107. NewXMPxmpTag => { Groups => { 2 => 'Author' } },
  108. # add more user-defined XMP-xmp tags here...
  109. },
  110. # special Geotag tags for XMP-exif:
  111. 'Image::ExifTool::XMP::exif' => {
  112. # Example 6. XMP-exif:GPSPitch
  113. GPSPitch => { Writable => 'rational', Groups => { 2 => 'Location' } },
  114. # Example 7. XMP-exif:GPSRoll
  115. GPSRoll => { Writable => 'rational', Groups => { 2 => 'Location' } },
  116. },
  117. # new XMP namespaces (eg. xxx) must be added to the Main XMP table:
  118. 'Image::ExifTool::XMP::Main' => {
  119. # namespace definition for examples 8 to 11
  120. xxx => { # <-- must be the same as the NAMESPACE prefix
  121. SubDirectory => {
  122. TagTable => 'Image::ExifTool::UserDefined::xxx',
  123. # (see the definition of this table below)
  124. },
  125. },
  126. # add more user-defined XMP namespaces here...
  127. },
  128. # new PNG tags are added to the PNG::TextualData table:
  129. 'Image::ExifTool::PNG::TextualData' => {
  130. # Example 12. PNG:NewPngTag1
  131. NewPngTag1 => { },
  132. # Example 13. PNG:NewPngTag2
  133. NewPngTag2 => { },
  134. # Example 14. PNG:NewPngTag3
  135. NewPngTag3 => { },
  136. },
  137. # add a new MIE tag (NewMieTag1) and group (MIE-Test) to MIE-Meta
  138. # (Note: MIE group names must NOT end with a number)
  139. 'Image::ExifTool::MIE::Meta' => {
  140. # Example 15. MIE-Meta:NewMieTag1
  141. NewMieTag1 => {
  142. Writable => 'rational64u',
  143. Units => [ 'cm', 'in' ],
  144. },
  145. # new MIE "Test" group for example 16
  146. Test => {
  147. SubDirectory => {
  148. TagTable => 'Image::ExifTool::UserDefined::MIETest',
  149. DirName => 'MIE-Test',
  150. },
  151. },
  152. },
  153. # Composite tags are added to the Composite table:
  154. 'Image::ExifTool::Composite' => {
  155. # Composite tags are unique: The Require/Desire elements specify
  156. # tags that must/may exist, and the keys of these hashes are used as
  157. # indices in the @val array of the ValueConv expression to access
  158. # the numerical (-n) values of these tags. All Require'd tags must
  159. # exist for the Composite tag to be evaluated. If no Require'd tags
  160. # are specified, then at least one of the Desire'd tags must exist.
  161. # See the Composite table in Image::ExifTool::Exif for more examples,
  162. # and lib/Image/ExifTool/README for all of the details.
  163. BaseName => {
  164. Require => {
  165. 0 => 'FileName',
  166. },
  167. # remove the extension from FileName
  168. ValueConv => '$val[0] =~ /(.*)\./ ? $1 : $val[0]',
  169. },
  170. # the next few examples demonstrate simplifications which may be
  171. # used if only one tag is Require'd or Desire'd:
  172. # 1) the Require lookup may be replaced with a simple tag name
  173. # 2) "$val" may be used to represent "$val[0]" in the expression
  174. FileExtension => {
  175. Require => 'FileName',
  176. ValueConv => '$val=~/\.([^.]*)$/; $1',
  177. },
  178. # override CircleOfConfusion tag to use D/1750 instead of D/1440
  179. CircleOfConfusion => {
  180. Require => 'ScaleFactor35efl',
  181. Groups => { 2 => 'Camera' },
  182. ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)',
  183. # an optional PrintConv may be used to format the value
  184. PrintConv => 'sprintf("%.3f mm",$val)',
  185. },
  186. # generate a description for this file type
  187. FileTypeDescription => {
  188. Require => 'FileType',
  189. ValueConv => 'GetFileType($val,1) || $val',
  190. },
  191. # calculate physical image size based on resolution
  192. PhysicalImageSize => {
  193. Require => {
  194. 0 => 'ImageWidth',
  195. 1 => 'ImageHeight',
  196. 2 => 'XResolution',
  197. 3 => 'YResolution',
  198. 4 => 'ResolutionUnit',
  199. },
  200. ValueConv => '$val[0]/$val[2] . " " . $val[1]/$val[3]',
  201. # (the @prt array contains print-formatted values)
  202. PrintConv => 'sprintf("%.1fx%.1f $prt[4]", split(" ",$val))',
  203. },
  204. # [advanced] select largest JPEG preview image
  205. BigImage => {
  206. Groups => { 2 => 'Preview' },
  207. Desire => {
  208. 0 => 'JpgFromRaw',
  209. 1 => 'PreviewImage',
  210. 2 => 'OtherImage',
  211. # (DNG and A100 ARW may be have 2 PreviewImage's)
  212. 3 => 'PreviewImage (1)',
  213. },
  214. # ValueConv may also be a code reference
  215. # Inputs: 0) reference to list of values, 1) ExifTool object
  216. ValueConv => sub {
  217. my $val = shift;
  218. my ($image, $bigImage, $len, $bigLen);
  219. foreach $image (@$val) {
  220. next unless ref $image eq 'SCALAR';
  221. # check for JPEG image (or "Binary data" if -b not used)
  222. next unless $$image =~ /^(\xff\xd8\xff|Binary data (\d+))/;
  223. $len = $2 || length $$image; # get image length
  224. # save largest image
  225. next if defined $bigLen and $bigLen >= $len;
  226. $bigLen = $len;
  227. $bigImage = $image;
  228. }
  229. return $bigImage;
  230. },
  231. },
  232. # **** ADD ADDITIONAL COMPOSITE TAG DEFINITIONS HERE ****
  233. },
  234. );
  235. # This is a basic example of the definition for a new XMP namespace.
  236. # This table is referenced through a SubDirectory tag definition
  237. # in the %Image::ExifTool::UserDefined definition above.
  238. # The namespace prefix for these tags is 'xxx', which corresponds to
  239. # an ExifTool family 1 group name of 'XMP-xxx'.
  240. %Image::ExifTool::UserDefined::xxx = (
  241. GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
  242. NAMESPACE => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' },
  243. WRITABLE => 'string',
  244. # Example 8. XMP-xxx:NewXMPxxxTag1
  245. # - replace "NewXMPxxxTag1" with your own tag name (eg. "MyTag")
  246. NewXMPxxxTag1 => { Writable => 'lang-alt' },
  247. # Example 9. XMP-xxx:NewXMPxxxTag2
  248. NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
  249. # Example 10. XMP-xxx:NewXMPxxxTag3
  250. NewXMPxxxTag3 => { List => 'Bag' },
  251. # Example 11. XMP-xxx:NewXMPxxxStruct
  252. # - example structured XMP tag
  253. NewXMPxxxStruct => {
  254. # the "Struct" entry defines the structure fields
  255. Struct => {
  256. # optional namespace prefix and URI for structure fields
  257. # (required only if different than NAMESPACE above)
  258. NAMESPACE => { 'test' => 'http://x.y.z/test/' },
  259. # optional structure name (used for warning messages only)
  260. STRUCT_NAME => 'MyStruct',
  261. # optional rdf:type property for the structure
  262. TYPE => 'http://x.y.z/test/xystruct',
  263. # structure field definitions (very similar to tag definitions)
  264. X => { Writable => 'integer' },
  265. Y => { Writable => 'integer' },
  266. # a nested structure...
  267. Things => {
  268. List => 'Bag',
  269. Struct => {
  270. NAMESPACE => { thing => 'http://x.y.z/thing/' },
  271. What => { },
  272. Where => { },
  273. },
  274. },
  275. },
  276. List => 'Seq', # structures may also be elements of a list
  277. },
  278. # Each field in the structure has an automatically-generated
  279. # corresponding flattened tag with an ID that is the concatenation
  280. # of the original structure tag ID and the field name (after
  281. # capitalizing the first letter of the field name if necessary).
  282. # The Name and/or Description of these flattened tags may be changed
  283. # if desired, but all other tag properties are taken from the
  284. # structure field definition. When this is done, the "Flat" flag
  285. # must also be set in the tag definition. For example:
  286. NewXMPxxxStructX => { Name => 'SomeOtherName', Flat => 1 },
  287. );
  288. # Adding a new MIE group requires a few extra definitions
  289. use Image::ExifTool::MIE;
  290. %Image::ExifTool::UserDefined::MIETest = (
  291. %Image::ExifTool::MIE::tableDefaults, # default MIE table entries
  292. GROUPS => { 0 => 'MIE', 1 => 'MIE-Test', 2 => 'Document' },
  293. WRITE_GROUP => 'MIE-Test',
  294. # Example 16. MIE-Test:NewMieTag2
  295. NewMieTag2 => { }, # new user-defined tag in MIE-Test group
  296. );
  297. # A special 'Lenses' list can be defined to give priority to specific lenses
  298. # in the logic to determine a lens model for the Composite:LensID tag
  299. @Image::ExifTool::UserDefined::Lenses = (
  300. 'Sigma AF 10-20mm F4-5.6 EX DC',
  301. 'Tokina AF193-2 19-35mm f/3.5-4.5',
  302. );
  303. # User-defined file types to recognize
  304. %Image::ExifTool::UserDefined::FileTypes = (
  305. XXX => { # <-- the extension of the new file type (case insensitive)
  306. # BaseType specifies the format upon which this file is based.
  307. # If BaseType is defined, then the file will be fully supported,
  308. # and in this case the Magic pattern should not be defined
  309. BaseType => 'TIFF',
  310. MIMEType => 'image/x-xxx',
  311. Description => 'My XXX file type',
  312. },
  313. YYY => {
  314. # without BaseType, the file will be recognized but not supported
  315. Magic => '0123abcd', # regular expression to match at start of file
  316. MIMEType => 'application/test',
  317. Description => 'My YYY file type',
  318. },
  319. ZZZ => {
  320. # if neither BaseType nor Magic are defined, the file will be
  321. # recognized by extension only
  322. Descripton => 'My ZZZ file type',
  323. },
  324. );
  325. # Specify default ExifTool option values
  326. # (see the Options function documentation for available options)
  327. %Image::ExifTool::UserDefined::Options = (
  328. CoordFormat => '%.6f', # change default GPS coordinate format
  329. Duplicates => 1, # make -a default for the exiftool app
  330. GeoMaxHDOP => 4, # ignore GPS fixes with HDOP > 4
  331. SystemTags => 1, # extract additional File System tags
  332. );
  333. #------------------------------------------------------------------------------
  334. 1; #end