config.html 17 KB

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