ExifTool.html 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088
  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>
  5. <title>Image::ExifTool</title>
  6. <link rel=stylesheet type='text/css' href='style.css' title='Style'>
  7. <style type="text/css">
  8. <!--
  9. pre { padding: 0; margin: 0px 2px }
  10. ul { margin-top: 0 }
  11. -->
  12. </style>
  13. </head>
  14. <body>
  15. <h1 class='up'>The Image::ExifTool Perl Library Module</h1>
  16. <h2>Description</h2>
  17. <p>The Image::ExifTool library provides a set of Perl modules to read and
  18. write meta information in a wide variety of image, audio, video and document
  19. files.</p>
  20. <hr><h2><a name="Methods">Methods</a></h2>
  21. <p>All ExifTool features are accessed through the methods of the public
  22. interface listed below. Other Image::ExifTool methods and modules should not be
  23. accessed directly because their interface may change with future versions.</p>
  24. <p>The ExifTool methods should never die or issue a warning to STDERR if called
  25. with the proper arguments (with the exception of
  26. <a href="#SetNewValue">SetNewValue</a> which may send an error message to
  27. STDERR, but only when called in scalar context). Error and warning messages
  28. that occur during processing are stored in the values of the Error and Warning
  29. tags, and are accessible via the <a href="#GetValue">GetValue</a> method to
  30. retrieve a single Error or Warning message, or <a href="#GetInfo">GetInfo</a> to
  31. retrieve any number of them.</p>
  32. <p>The ExifTool methods are not thread safe.</p>
  33. <table><tr><td valign=top>
  34. <ul>
  35. <li><a href="#ImageInfo">ImageInfo</a></li>
  36. <li><a href="#new">new</a></li>
  37. <li><a href="#Options">Options</a></li>
  38. <li><a href="#ClearOptions">ClearOptions</a></li>
  39. <li><a href="#ExtractInfo">ExtractInfo</a></li>
  40. <li><a href="#GetInfo">GetInfo</a></li>
  41. <li><a href="#WriteInfo">WriteInfo</a></li>
  42. <li><a href="#GetTagList">GetTagList</a></li>
  43. <li><a href="#GetFoundTags">GetFoundTags</a></li>
  44. <li><a href="#GetRequestedTags">GetRequestedTags</a></li>
  45. <li><a href="#GetValue">GetValue</a></li>
  46. <li><a href="#SetNewValue">SetNewValue</a></li>
  47. </ul>
  48. </td><td valign=top>
  49. <ul>
  50. <li><a href="#GetNewValue">GetNewValue</a></li>
  51. <li><a href="#SetNewValuesFromFile">SetNewValuesFromFile</a></li>
  52. <li><a href="#CountNewValues">CountNewValues</a></li>
  53. <li><a href="#SaveNewValues">SaveNewValues</a></li>
  54. <li><a href="#RestoreNewValues">RestoreNewValues</a></li>
  55. <li><a href="#SetFileModifyDate">SetFileModifyDate</a></li>
  56. <li><a href="#SetFileName">SetFileName</a></li>
  57. <li><a href="#SetNewGroups">SetNewGroups</a></li>
  58. <li><a href="#GetNewGroups">GetNewGroups</a></li>
  59. <li><a href="#GetTagID">GetTagID</a></li>
  60. <li><a href="#GetDescription">GetDescription</a></li>
  61. <li><a href="#GetGroup">GetGroup</a></li>
  62. </ul>
  63. </td><td valign=top>
  64. <ul>
  65. <li><a href="#GetGroups">GetGroups</a></li>
  66. <li><a href="#BuildCompositeTags">BuildCompositeTags</a></li>
  67. <li><a href="#GetTagName">GetTagName</a></li>
  68. <li><a href="#GetShortcuts">GetShortcuts</a></li>
  69. <li><a href="#GetAllTags">GetAllTags</a></li>
  70. <li><a href="#GetWritableTags">GetWritableTags</a></li>
  71. <li><a href="#GetAllGroups">GetAllGroups</a></li>
  72. <li><a href="#GetDeleteGroups">GetDeleteGroups</a></li>
  73. <li><a href="#GetFileType">GetFileType</a></li>
  74. <li><a href="#CanWrite">CanWrite</a></li>
  75. <li><a href="#CanCreate">CanCreate</a></li>
  76. <li><a href="#AddUserDefinedTags">AddUserDefinedTags</a></li>
  77. </ul>
  78. </td></tr></table>
  79. <hr><h2><a name="UsingExifTool">Using ExifTool</a></h2>
  80. <p>The ExifTool module may be used by simply calling the
  81. <a href="#ImageInfo">ImageInfo</a> function:</p>
  82. <blockquote><table class='box'><tr><td><pre>
  83. use Image::ExifTool qw(:Public);
  84. my $info = <a href="#ImageInfo">ImageInfo</a>('image.jpg');
  85. </pre></td></tr></table></blockquote>
  86. <p>or in a more object-oriented fashion, by creating an ExifTool object:</p>
  87. <blockquote><table class='box'><tr><td><pre>
  88. use Image::ExifTool;
  89. my $exifTool = <a href="#new">new</a> Image::ExifTool;
  90. my $info = $exifTool-&gt;<a href="#ImageInfo">ImageInfo</a>('image.jpg');
  91. </pre></td></tr></table></blockquote>
  92. <p>The object-oriented method allows more flexibility, but is slightly more
  93. complicated. You choose the method that you prefer.</p>
  94. <p>The $info value returned by <a href="#ImageInfo">ImageInfo</a> in the above
  95. examples is a reference to a hash containing the tag/value pairs. Here is a
  96. simplified example which prints out this information:</p>
  97. <blockquote><table class='box'><tr><td><pre>
  98. foreach (keys %$info) {
  99. print "$_ =&gt; $$info{$_}\n";
  100. }
  101. </pre></td></tr></table></blockquote>
  102. <p>See <a href="#ImageInfo">ImageInfo</a> for a more detailed description of the
  103. info hash entries.</p>
  104. <p>And the technique for writing meta information is equally simple:</p>
  105. <blockquote><table class='box'><tr><td><pre>
  106. use Image::ExifTool;
  107. my $exifTool = <a href="#new">new</a> Image::ExifTool;
  108. $exifTool-&gt;<a href="#SetNewValue">SetNewValue</a>(Author =&gt; 'Phil Harvey');
  109. $exifTool-&gt;<a href="#WriteInfo">WriteInfo</a>('image.jpg','modified_image.jpg');
  110. </pre></td></tr></table></blockquote>
  111. <hr><h2><a name="Config">Configuration</a></h2>
  112. <p>User-defined tags can be added via the ExifTool configuration file, or by
  113. defining the %Image::ExifTool::UserDefined hash before calling any ExifTool
  114. functions. See "<a href="config.html">ExifTool_config</a>" in the ExifTool
  115. distribution for more details.</p>
  116. <p>By default ExifTool looks for a configuration file named ".ExifTool_config"
  117. first in your home directory, then in the directory of the application script,
  118. but a different directory may be specified by setting the EXIFTOOL_HOME
  119. environment variable, or a different file may be specified by setting the
  120. ExifTool "<code>configFile</code>" variable before using Image::ExifTool. For
  121. example:</p>
  122. <blockquote><table class='box'><tr><td><pre>
  123. BEGIN { $Image::ExifTool::configFile = '/Users/phil/myconfig.cfg' }
  124. use Image::ExifTool;
  125. </pre></td></tr></table></blockquote>
  126. <p>The configuration feature may also be disabled by setting
  127. "<code>configFile</code>" to an empty string:</p>
  128. <blockquote><table class='box'><tr><td><pre>
  129. BEGIN { $Image::ExifTool::configFile = '' }
  130. use Image::ExifTool;
  131. </pre></td></tr></table></blockquote>
  132. <hr><h2><a name="ImageInfo">ImageInfo</a></h2>
  133. <p>Read image file and return meta information. This is the one-step function for
  134. retrieving meta information from an image. Internally,
  135. <a href="#ImageInfo">ImageInfo</a> calls <a href="#ExtractInfo">ExtractInfo</a>
  136. to extract data from the image, <a href="#GetInfo">GetInfo</a> to generate the
  137. information hash, and <a href="#GetTagList">GetTagList</a> for the returned tag
  138. list.</p>
  139. <blockquote><table class='norm'>
  140. <tr><td><b>Prototype</b></td><td>ImageInfo($;@)</td></tr>
  141. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> [<i>optional</i>] ExifTool object reference
  142. <br><b>1)</b> File name, file reference or scalar reference
  143. <br><b>2-N)</b> [<i>optional</i>] list of tag names to find (or tag list reference or
  144. options reference, see below)
  145. </td></tr>
  146. <tr><td valign=top><b>Returns</b></td><td>Reference to hash of tag key/value pairs</td></tr>
  147. </table></blockquote>
  148. <p><b>Examples:</b></p>
  149. <blockquote>Non object-oriented example showing use of options and returning tag list:
  150. <table class='box'><tr><td><pre>
  151. use Image::ExifTool qw(ImageInfo);
  152. my @ioTagList;
  153. my $info;
  154. $info = <b>ImageInfo</b>('image.jpg', \@ioTagList, {Sort =&gt; 'Group0'});
  155. </pre></td></tr></table></blockquote>
  156. <blockquote>Object-oriented example to read from a file that is already open:
  157. <table class='box'><tr><td><pre>
  158. my $exifTool = <a href="#new">new</a> Image::ExifTool;
  159. $info = $exifTool-&gt;<b>ImageInfo</b>(\*FILE_PT, 'Aperture', 'ShutterSpeed', 'ISO');
  160. </pre></td></tr></table></blockquote>
  161. <blockquote>Extract information from an image in memory:
  162. <table class='box'><tr><td><pre>
  163. $info = $exifTool-&gt;<b>ImageInfo</b>(\$imageData);
  164. </pre></td></tr></table></blockquote>
  165. <blockquote>Extract information from an embedded thumbnail image:
  166. <table class='box'><tr><td><pre>
  167. $info = <b>ImageInfo</b>('image.jpg', 'thumbnailimage');
  168. my $thumbInfo = <b>ImageInfo</b>($$info{ThumbnailImage});
  169. </pre></td></tr></table></blockquote>
  170. <blockquote>Using an ExifTool object to set the options before calling
  171. <a href="#ImageInfo">ImageInfo</a>:
  172. <table class='box'><tr><td><pre>
  173. my $filename = shift || die "Please specify filename\n";
  174. my @ioTagList = qw(filename imagesize xmp:creator exif:* -ifd1:*);
  175. $exifTool-&gt;<a href="#Options">Options</a>(Unknown =&gt; 1, DateFormat =&gt; '%H:%M:%S %a. %b. %e, %Y');
  176. $info = $exifTool-&gt;<b>ImageInfo</b>($filename, \@ioTagList);
  177. </pre></td></tr></table></blockquote>
  178. <p><b>Function Arguments:</b></p>
  179. <p><a href="#ImageInfo">ImageInfo</a> is very flexible about the arguments
  180. passed to it, and interprets them based on their type. It may be called with
  181. one or more arguments. The one required argument is either a SCALAR (the image
  182. file name), a file reference (a reference to the image file) or a SCALAR
  183. reference (a reference to the image in memory). Other arguments are optional.
  184. The order of the arguments is not significant, except that the first SCALAR is
  185. taken to be the file name unless a file reference or scalar reference comes
  186. earlier in the argument list.</p>
  187. <p>Below is a more detailed explanation of how the <a href="#ImageInfo">ImageInfo</a>
  188. function arguments are interpreted.</p>
  189. <blockquote><table class='norm'>
  190. <tr><td valign=top><b>ExifTool&nbsp;ref</b></td><td>
  191. <a href="#ImageInfo">ImageInfo</a> may be called with an ExifTool object if
  192. desired. Advantages of using the object-oriented form are that options may be
  193. set before calling <a href="#ImageInfo">ImageInfo</a>, and the object may be
  194. used afterward to access member functions. Must be the first argument if used.
  195. </td></tr><tr><td valign=top><b>SCALAR</b></td><td>
  196. The first scalar argument is taken to be the file name unless an earlier
  197. argument specified the image data via a file reference (file ref) or data
  198. reference (SCALAR ref). The remaining scalar arguments are names of tags for
  199. requested information. All tags are returned if no tags are specified.
  200. <br>&nbsp;<br>
  201. Tag names are case-insensitive and may be prefixed by optional group names
  202. separated by colons. A group name may begin with a family number (eg.
  203. '<code>1IPTC:Keywords</code>'), to restrict matches to a specific family. In the
  204. tag name, a '<code>?</code>' matches any single character and a '<code>*</code>'
  205. matches zero or more characters. Thus '<code>GROUP:*</code>' represents all
  206. tags in a specific group. Wildcards may not be used in group names, with the
  207. exception that a group name of '<code>*</code>' may be used to extract all
  208. available instances of a tag regardless of the
  209. <a href="#Duplicates">Duplicates</a> setting (eg. '<code>*:WhiteBalance</code>').
  210. Multiple groups may be specified (eg. '<code>EXIF:Time:*</code>' extracts all
  211. EXIF Time tags). And finally, a leading '<code>-</code>' indicates a tag to be
  212. excluded (eg. '<code>-IFD1:*</code>'), or a trailing '<code>#</code>' causes the
  213. ValueConv value to be returned for this tag.
  214. <br>&nbsp;<br>
  215. Note that keys in the returned information hash and elements of the returned tag
  216. list are not necessarily the same as these tag names because group names are
  217. removed, the case may be changed, and an instance number may be added. For this
  218. reason it is best to use either the keys of the returned hash or the elements of
  219. the returned tag list when accessing the tag values.
  220. <br>&nbsp;<br>
  221. See the <a href="TagNames/index.html">TagNames</a> documentation for a
  222. complete list of ExifTool tag names.
  223. </td></tr><tr><td valign=top><b>File&nbsp;ref</b></td><td>
  224. A reference to an open image file. If you use this method (or a SCALAR
  225. reference) to access information in an image, the FileName and Directory tags
  226. will not be returned. (Also, the FileSize, FileModifyDate, FilePermissions and
  227. FileAttributes tags will not be returned unless it is a plain file.) Image
  228. processing begins at the current file position, and on return the file position
  229. is unspecified. May be either a standard filehandle or a reference to a
  230. File::RandomAccess object.
  231. <br>&nbsp;<br>
  232. [Advanced: To allow a non-rewindable stream (eg. a network socket) to be
  233. re-read after processing with ExifTool, first wrap the file reference in a
  234. File::RandomAccess object, then pass this object to
  235. <a href="#ImageInfo">ImageInfo</a>. The File::RandomAccess object will buffer
  236. the file if necessary, and may be used to re-read the file after
  237. <a href="#ImageInfo">ImageInfo</a> returns.]
  238. </td></tr><tr><td valign=top><b>SCALAR&nbsp;ref</b></td><td>
  239. A reference to image data in memory.
  240. </td></tr><tr><td valign=top><b>ARRAY&nbsp;ref</b></td><td>
  241. Reference to a list of tag names. On entry, any elements in the list are added
  242. to the list of requested tags. On return, this list is updated to contain an
  243. ordered list of tag keys for the returned information.
  244. <br>&nbsp;<br>
  245. There will be 1:1 correspondence between the requested tags and the returned
  246. tag keys only if the <a href="#Duplicates">Duplicates</a> option is 0 and
  247. <a href="#Sort">Sort</a> is 'Input'. (With
  248. <a href="#Duplicates">Duplicates</a> enabled, there may be more entries in the
  249. returned list of tag keys, and with other <a href="#Sort">Sort</a> settings the
  250. entries may not be in the same order as requested.) If a requested tag doesn't
  251. exist, a tag key is still generated, but the tag value is undefined.
  252. </td></tr><tr><td valign=top><b>HASH&nbsp;ref</b></td><td>
  253. Reference to a hash containing the options settings. See
  254. <a href="#Options">Options</a> documentation below for a list of available
  255. options. Options specified as arguments to <a href="#ImageInfo">ImageInfo</a>
  256. take precedence over <a href="#Options">Options</a> settings.
  257. </td></tr></table></blockquote>
  258. <p><b>Return Value:</b></p>
  259. <p><a href="#ImageInfo">ImageInfo</a> returns a reference to a hash of tag
  260. key/value pairs. The tag keys are identifiers, which are similar to the tag
  261. names but may have an appended instance number if multiple tags with the same
  262. name were extracted from the image. Many of the ExifTool functions require a
  263. tag key as an argument. Use <a href="#GetTagName">GetTagName</a> to get the tag
  264. name for a given tag key. Note that the case of the tag names may not be the
  265. same as requested.</p>
  266. <p>Values of the returned hash are usually simple scalars, but a scalar
  267. reference is used to indicate binary data and an array reference may be used to
  268. indicate a list. Also, a hash reference may be returned if the
  269. <a href="#Struct">Struct</a> option is used. Lists of values are joined by
  270. commas into a single string only if the PrintConv option is enabled and the List
  271. option is disabled (which are the defaults). Note that binary values are not
  272. necessarily extracted unless specifically requested, or the Binary option is
  273. enabled and the tag is not specifically excluded. If not extracted the value is
  274. a reference to a string of the form "<code>Binary data ##### bytes</code>".</p>
  275. <p>Here is a simple example to print out the information returned by
  276. <a href="#ImageInfo">ImageInfo</a>:</p>
  277. <blockquote><table class='box'><tr><td><pre>
  278. foreach (keys %$info) {
  279. my $val = $$info{$_};
  280. if (ref $val eq 'ARRAY') {
  281. $val = join(', ', @$val);
  282. } elsif (ref $val eq 'SCALAR') {
  283. $val = '(Binary data)';
  284. }
  285. printf("%-24s : %s\n", $_, $val);
  286. }
  287. </pre></td></tr></table></blockquote>
  288. <p>which gives output like this (PrintConv enabled):</p>
  289. <blockquote><table class='box'><tr><td><pre>
  290. WhiteBalance : Auto
  291. FNumber : 3.5
  292. InteroperabilityOffset : 936
  293. XResolution : 72
  294. ISO : 100
  295. ThumbnailImage : (Binary data)
  296. FlashOn : On
  297. Make : FUJIFILM
  298. ShutterSpeedValue : 1/64
  299. ExposureCompensation : 0
  300. Sharpness : Soft
  301. ResolutionUnit : inches
  302. </pre></td></tr></table></blockquote>
  303. <p><b>Notes:</b></p>
  304. <p>ExifTool returns all values as byte strings of encoded characters. Perl wide
  305. characters are not used. See <a href="faq.html#Q10">FAQ number 10</a> for
  306. details about the encodings. By default, most returned strings are encoded in
  307. UTF-8. For these, Encode::decode_utf8() may be used to convert to a sequence of
  308. logical Perl characters.</p>
  309. <p>As well as tags representing information extracted from the image, the
  310. following <a href="TagNames/Extra.html">Extra tags</a> generated by ExifTool may
  311. be returned:</p>
  312. <blockquote><table class='norm'>
  313. <tr><td><b>ExifToolVersion</b></td><td>The ExifTool version number</td></tr>
  314. <tr><td><b>Error</b></td><td>An error message if the image could not be processed</td></tr>
  315. <tr><td><b>Warning</b></td><td>A warning message if problems were encountered
  316. while processing the image</td></tr>
  317. </table></blockquote>
  318. <hr><h2><a name="new">new</a></h2>
  319. <p>Create a new ExifTool object.</p>
  320. <p><b>Example:</b></p>
  321. <blockquote><table class='box'><tr><td><pre>
  322. my $exifTool = <b>new</b> Image::ExifTool;
  323. </pre></td></tr></table></blockquote>
  324. <p>Note that ExifTool uses AUTOLOAD to load non-member methods, so any class
  325. using Image::ExifTool as a base class must define an AUTOLOAD which calls
  326. Image::ExifTool::DoAutoLoad(). ie)</p>
  327. <blockquote><table class='box'><tr><td><pre>
  328. sub AUTOLOAD
  329. {
  330. Image::ExifTool::DoAutoLoad($AUTOLOAD, @_);
  331. }
  332. </pre></td></tr></table></blockquote>
  333. <hr><table bgcolor='#aaffaa' width='100%' cellpadding=8><tr><td><center><b>
  334. The following functions require an ExifTool object as the first argument
  335. </b></center></td></tr></table>
  336. <hr><h2><a name='options'></a><a name="Options">Options</a></h2>
  337. <p>Get/set ExifTool options. This function can be called to set the default
  338. options for an ExifTool object. Options set this way are in effect for
  339. all function calls but may be overridden by options passed as arguments
  340. to some functions. Option names are not case sensitive.</p>
  341. <p>The default option values may be changed by defining a
  342. %Image::ExifTool::UserDefined::Options hash. See the
  343. <a href="config.html">ExifTool_config file</a> in the full ExifTool
  344. distribution for examples.</p>
  345. <blockquote><table class='norm'>
  346. <tr><td><b>Prototype</b></td><td>Options($$;@)</td></tr>
  347. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  348. <br><b>1)</b> Parameter name (case-insensitive, see table below)
  349. <br><b>2)</b> [<i>optional</i>] Option value if specified (may be undef to clear option)
  350. <br><b>3-N)</b> [<i>optional</i>] Additional parameter/value pairs
  351. </td></tr>
  352. <tr><td valign=top><b>Returns</b></td><td>Previous value of last specified parameter</td></tr>
  353. </table></blockquote>
  354. <p><b>Available options:</b></p>
  355. <blockquote>
  356. <table class='norm'>
  357. <tr><th colspan=4 bgcolor='#dddddd'><font size='+1'>ExifTool Options</font></th></tr>
  358. <tr><th>Option</th><th>Description</th><th>Values</th><th>Default</th></tr>
  359. <tr><td>Binary</td><td><a name="Binary"></a>Flag to extract the value data for all binary tags.
  360. Tag values representing large binary data blocks (eg. ThumbnailImage)
  361. are not necessarily extracted unless this option is set or the tag is
  362. specifically requested by name.</td>
  363. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  364. <tr><td>ByteOrder</td><td><a name="ByteOrder"></a>The byte order for newly created EXIF segments when
  365. writing. Note that if EXIF information already exists, the existing order is
  366. maintained. If ByteOrder is not defined, then the order of the maker notes is
  367. used (if they are being copied), otherwise big-endian ('MM') order is assumed.
  368. This can also be set via the <a href="TagNames/Extra.html">ExifByteOrder tag</a>,
  369. but the ByteOrder option takes precedence if both are set.</td>
  370. <td align=center>'MM','II' or undef</td><td align=center>undef</td></tr>
  371. <tr><td>Charset</td><td>Character set for encoding character
  372. strings passed to/from ExifTool containing code points above U+007F. Note
  373. that this option affects some types of information when reading/writing the
  374. file and other types when getting/setting tag values, so it must be defined
  375. for both types of access. Charset values listed to the right have aliases
  376. which are given in brackets. Case is not significant. See
  377. <a href="faq.html#Q10">FAQ #10</a> for more information about character sets.</td>
  378. <td align=center><a name="Charset"></a><table class=clear>
  379. <tr><td valign=top align=right>UTF8</td><td>(cp65001, UTF-8)</td></tr>
  380. <tr><td valign=top align=right>Latin</td><td>(cp1252, Latin1)</td></tr>
  381. <tr><td valign=top align=right>Latin2</td><td>(cp1250)</td></tr>
  382. <tr><td valign=top align=right>Cyrillic</td><td>(cp1251, Russian)</td></tr>
  383. <tr><td valign=top align=right>Greek</td><td>(cp1253)</td></tr>
  384. <tr><td valign=top align=right>Turkish</td><td>(cp1254)</td></tr>
  385. <tr><td valign=top align=right>Hebrew</td><td>(cp1255)</td></tr>
  386. <tr><td valign=top align=right>Arabic</td><td>(cp1256)</td></tr>
  387. <tr><td valign=top align=right>Baltic</td><td>(cp1257)</td></tr>
  388. <tr><td valign=top align=right>Vietnam</td><td>(cp1258)</td></tr>
  389. <tr><td valign=top align=right>Thai</td><td>(cp874)</td></tr>
  390. <tr><td valign=top align=right>MacRoman</td><td>(cp10000, Mac, Roman)</td></tr>
  391. <tr><td valign=top align=right>MacLatin2</td><td>(cp10029)</td></tr>
  392. <tr><td valign=top align=right>MacCyrillic</td><td>(cp10007)</td></tr>
  393. <tr><td valign=top align=right>MacGreek</td><td>(cp10006)</td></tr>
  394. <tr><td valign=top align=right>MacTurkish</td><td>(cp10081)</td></tr>
  395. <tr><td valign=top align=right>MacRomanian</td><td>(cp10010)</td></tr>
  396. <tr><td valign=top align=right>MacIceland</td><td>(cp10079)</td></tr>
  397. <tr><td valign=top align=right>MacCroatian</td><td>(cp10082)</td></tr>
  398. </table></td><td align=center>'UTF8'</td></tr>
  399. <tr><td>CharsetEXIF</td><td><a name="CharsetEXIF"></a>Internal encoding to use for stored
  400. EXIF "ASCII" string values. May also be set to undef to pass through EXIF
  401. "ASCII" values without recoding. Set to "UTF8" to conform with the MWG
  402. recommendation.</td>
  403. <td align=center><i>(see <a href="#Charset">Charset</a> option)</i><br>or undef</td><td align=center>undef</td></tr>
  404. <tr><td>CharsetFileName</td><td><a name="CharsetFileName"></a>External character set
  405. used when specifying file names. When set in Windows, this triggers use of
  406. Windows Unicode file library routines (requires Win32API::File).</td>
  407. <td align=center><i>(see <a href="#Charset">Charset</a> option)</i><br>or undef</td><td align=center>undef</td></tr>
  408. <tr><td>CharsetID3</td><td><a name="CharsetID3"></a>Internal encoding to assume for ID3v1 strings. By
  409. the specification ID3v1 strings should be encoded in ISO 8859-1 (essentially
  410. 'Latin'), but some applications may use local encoding instead. This option
  411. allows different encodings to be specified.</td>
  412. <td align=center><i>(see <a href="#Charset">Charset</a> option)</i></td><td align=center>'Latin'</td></tr>
  413. <tr><td>CharsetIPTC</td><td><a name="CharsetIPTC"></a>Fallback internal IPTC character set to assume if IPTC information
  414. contains no CodedCharacterSet tag.</td>
  415. <td align=center><i>(see <a href="#Charset">Charset</a> option)</i></td><td align=center>'Latin'</td></tr>
  416. <tr><td>CharsetPhotoshop</td><td><a name="CharsetPhotoshop"></a>Internal encoding to assume for Photoshop IRB resource names.</td>
  417. <td align=center><i>(see <a href="#Charset">Charset</a> option)</i></td><td align=center>'Latin'</td></tr>
  418. <tr><td>CharsetQuickTime</td><td><a name="CharsetQuickTime"></a>Internal encoding to assume for QuickTime
  419. strings stored with an unspecified encoding.</td>
  420. <td align=center><i>(see <a href="#Charset">Charset</a> option)</i></td><td align=center>'MacRoman'</td></tr>
  421. <tr><td>Compact</td><td><a name="Compact"></a>Flag to write compact output. The XMP specification suggests
  422. that the data be padded with blanks to allow in-place editing. With this
  423. flag set the 2kB of padding is not written. Note that this only effects
  424. embedded XMP since padding is never written for stand-alone XMP files.</td>
  425. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  426. <tr><td>Composite</td><td><a name="Composite"></a>Flag to generate Composite tags when extracting information.</td>
  427. <td align=center>0 or 1</td><td align=center>1</td></tr>
  428. <tr><td>Compress</td><td><a name="Compress"></a>Flag to write new values in compressed format if possible.
  429. Has no effect unless Compress::Zlib is installed.</td>
  430. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  431. <tr><td>CoordFormat</td><td><a name="CoordFormat"></a>Specify output format for GPS coordinates.</td>
  432. <td>A printf-style format string with specifiers for degrees, minutes and
  433. seconds in that order, however minutes and seconds may be omitted. If the
  434. hemisphere is known, a reference direction (N, S, E or W) is appended to
  435. each printed coordinate, but adding a '<code>+</code>' to the first format
  436. specifier (eg. <code>'%+.6f'</code>) prints a signed coordinate instead.
  437. The default for reading is equivalent to a format string of
  438. <code>q{%d&nbsp;deg&nbsp;%d'&nbsp;%.2f"}</code>, but to avoid a loss
  439. of precision the default for copying tags with
  440. <a href="#SetNewValuesFromFile">SetNewValuesFromFile</a> is
  441. <code>q{%d&nbsp;%d&nbsp;%.8f}</code>.
  442. </td><td align=center>undef</td></tr>
  443. <tr><td>DateFormat</td><td><a name="DateFormat"></a>Output format for date/time values. If date can not
  444. be converted, value is left unchanged unless the StrictDate option is set.
  445. Timezones are ignored.</td> <td>See strftime manpage for details. The default
  446. is similar to a format string of <code>"%Y:%m:%d %H:%M:%S"</code>.</td>
  447. <td align=center>undef</td></tr>
  448. <tr><td>Duplicates</td><td><a name="Duplicates"></a>Flag to return values from
  449. tags with duplicate names when extracting information.</td>
  450. <td align=center>0 or 1</td><td align=center>1</td></tr>
  451. <tr><td>Escape</td>
  452. <td><a name="Escape"></a>Escape special characters in extracted values for
  453. HTML or XML. Also unescapes HTML or XML character entities in input values
  454. passed to <a href="#SetNewValue">SetNewValue</a>.</td> <td
  455. align=center>HTML, XML or undef</td>
  456. <td align=center>undef</td></tr>
  457. <tr><td>Exclude</td>
  458. <td>Exclude specified tags when extracting information.</td>
  459. <td><a name="Exclude"></a>Tag name or reference to a list of tag names to
  460. exclude. Case is not significant. Tags may also be excluded by preceding
  461. their name with a '-' in the arguments to ImageInfo.</td>
  462. <td align=center>undef</td></tr>
  463. <tr><td>ExtendedXMP</td><td><a name="ExtendedXMP"></a>This setting affects the
  464. reading and editing of extended XMP in JPEG images. According to the XMP
  465. specification, extended XMP is only valid if it has the GUID specified by
  466. the <a href="TagNames/XMP.html#xmpNote">HasExtendedXMP tag</a>. ExifTool
  467. 9.95 and earlier would read extended XMP regardless of GUID, but with the
  468. addition of this option in version 9.96 the default behaviour was changed to
  469. conform with the XMP specification (to read only extended XMP with the
  470. proper GUID). This option should be set to 2 to emulate pre-9.96 behaviour
  471. and read all extended XMP. It may also be set to a GUID to read a specific
  472. extended XMP, or 0 to ignore extended XMP entirely.</td>
  473. <td><table class=clear>
  474. <tr><td valign=top align=right><b>0</b>&nbsp;=</td><td>ignore extended XMP</td></tr>
  475. <tr><td valign=top align=right><b>1</b>&nbsp;=</td><td>valid GUID only</td></tr>
  476. <tr><td valign=top align=right><b>2</b>&nbsp;=</td><td>any GUID</td></tr>
  477. <tr><td valign=top align=right><i>guid</i>&nbsp;=</td><td>specific GUID</td></tr>
  478. </table></td><td align=center>1</td></tr>
  479. <tr><td>ExtractEmbedded</td>
  480. <td><a name="Embedded"></a>Flag to extract information from embedded
  481. documents in EPS files, embedded EPS information and JPEG and Jpeg2000
  482. images in PDF files, embedded MPF images in JPEG and MPO files, streaming
  483. metadata in AVCHD videos, and the resource fork of Mac OS files.</td>
  484. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  485. <tr><td>FastScan</td>
  486. <td><a name="FastScan"></a>Flag to increase speed of extracting information
  487. from JPEG images. With this option set to 1, ExifTool will not scan to the
  488. end of a JPEG image to check for an AFCP, CanonVRD, FotoStation,
  489. PhotoMechanic, MIE or PreviewImage trailer. This also stops the parsing
  490. after the first comment in GIF images, and at the audio/video data with
  491. RIFF-format files (AVI, WAV, etc), so any trailing metadata (ie.eg. XMP written
  492. by some utilities) may be missed. When combined with the ScanForXMP option,
  493. prevents scanning for XMP in recognized file types. With a value of 2,
  494. ExifTool will also avoid extracting any EXIF MakerNote information. When set
  495. to 3, the file is not actually parsed, and only an initial guess at FileType
  496. and some pseudo tags are returned. </td>
  497. <td align=center>0, 1, 2 or 3</td><td align=center>undef</td></tr>
  498. <tr><td>Filter</td>
  499. <td>Perl expression used to filter all returned tag values. Applies to
  500. PrintConv values only.</td><td><a name="Filter"></a>Expression to act on the
  501. value of the Perl default variable ($_), changing the value of this variable
  502. as required</td> <td align=center>undef</td></tr>
  503. <tr><td>FixBase</td>
  504. <td>Fix maker notes base offset. Allows values to be extracted from maker notes
  505. which have been corrupted by editing with 3rd party software.</td>
  506. <td><a name="FixBase"></a>An integer specifying a value to be added to the
  507. maker notes base offset, or the empty string ('') for ExifTool to take its
  508. best guess at the correct base.</td>
  509. <td align=center>undef</td></tr>
  510. <tr><td>GeoMaxIntSecs</td>
  511. <td><a name="GeoMaxIntSecs"></a>Maximum interpolation time in seconds for
  512. geotagging. Geotagging is treated as an extrapolation if the Geotime value
  513. lies between two fixes in the same track which are separated by a number of
  514. seconds greater than this. Otherwise, the coordinates are calculated as a
  515. linear interpolation between the nearest fixes on either side of the Geotime
  516. value. Set to 0 to disable interpolation and use the coordinates of the
  517. nearest fix instead (provided it is within GeoMaxExtSecs, otherwise
  518. geotagging fails).</td>
  519. <td align=center>A floating point number</td>
  520. <td align=center>1800</td></tr>
  521. <tr><td>GeoMaxExtSecs</td>
  522. <td><a name="GeoMaxExtSecs"></a>Maximum extrapolation time in seconds for
  523. geotagging. Geotagging fails if the Geotime value lies outside a GPS track
  524. by a number of seconds greater than this. Otherwise, the coordinates of the
  525. nearest fix are taken.</td>
  526. <td align=center>A floating point number</td>
  527. <td align=center>1800</td></tr>
  528. <tr><td>GeoMaxHDOP</td>
  529. <td><a name="GeoMaxHDOP"></a>Maximum Horizontal (2D) Dilution Of Precision
  530. for geotagging. GPS fixes are ignored if the HDOP is greater than this.</td>
  531. <td align=center>A floating point number, or undef</td>
  532. <td align=center>undef</td></tr>
  533. <tr><td>GeoMaxPDOP</td>
  534. <td><a name="GeoMaxPDOP"></a>Maximum Position (3D) Dilution Of Precision for
  535. geotagging. GPS fixes are ignored if the PDOP is greater than this.</td>
  536. <td align=center>A floating point number, or undef</td>
  537. <td align=center>undef</td></tr>
  538. <tr><td>GeoMinSats</td>
  539. <td><a name="GeoMinSats"></a>Minimum number of satellites for geotagging.
  540. GPS fixes are ignored if the number of acquired satellites is less than this.</td>
  541. <td align=center>A positive integer, or undef</td>
  542. <td align=center>undef</td></tr>
  543. <tr><td>GlobalTimeShift</td>
  544. <td><a name="GlobalTimeShift"></a>Time shift to apply to all extracted
  545. date/time PrintConv values. Does not affect ValueConv values.</td>
  546. <td align=center>Date/time shift string with leading '-' for negative shifts<br>(see <a href="Shift.html">Image::ExifTool::Shift.pl</a>)</td>
  547. <td align=center>undef</td></tr>
  548. <tr><td>Group#</td><td>Extract tags only for specified groups in family #
  549. (Group0 assumed if # not given).</td>
  550. <td><a name="Group"></a>Group name or reference to list of group names.
  551. Group name may begin with '-' to exclude a group. Case IS significant.
  552. See <a href="#GetGroup">GetGroup</a> for a description of group families,
  553. and <a href="#GetAllGroups">GetAllGroups</a> for a list of available groups.</td>
  554. <td align=center>undef</td></tr>
  555. <tr><td>HtmlDump</td><td>Dump information in hex to a dynamic HTML web page.
  556. Option value sets a limit on the maximum block size. Output file is
  557. specified by the TextOut option.</td>
  558. <td><a name="HtmlDump"></a><table class=clear>
  559. <tr><td valign=top align=center><b>0</b>&nbsp;=</td><td>No HTML dump</td></tr>
  560. <tr><td valign=top align=center><b>1</b>&nbsp;=</td><td>1 KB size limit</td></tr>
  561. <tr><td valign=top align=center><b>2</b>&nbsp;=</td><td>16 KB size limit</td></tr>
  562. <tr><td valign=top align=center><b>3</b>&nbsp;=</td><td>Full dump</td></tr>
  563. </table></td><td align=center>0</td></tr>
  564. <tr><td>HtmlDumpBase</td><td><a name="HtmlDumpBase"></a>Base for HTML dump
  565. offsets. If not defined, the EXIF/TIFF base offset is used.</td>
  566. <td><table class=clear>
  567. <tr><td valign=top align=right><b>0</b>&nbsp;=</td><td>Absolute offsets</td></tr>
  568. <tr><td valign=top align=right><i>non&#8209;zero</i>&nbsp;=</td><td>Relative offsets</td></tr>
  569. <tr><td valign=top align=right><b>undef</b>&nbsp;=</td><td>EXIF/TIFF offsets</td></tr>
  570. </table></td><td align=center>undef</td></tr>
  571. <tr><td>IgnoreMinorErrors</td><td><a name="IgnoreMinorErrors"></a>Flag to ignore minor errors. Causes minor
  572. errors to be downgraded to warnings, and minor warnings to be ignored. This
  573. option is provided mainly to allow writing of files when minor errors occur,
  574. but by ignoring some minor warnings the behaviour of ExifTool may be changed
  575. to allow some questionable operations to proceed (such as extracting
  576. thumbnail and preview images even if they don't have a recognizable header).
  577. Minor errors/warnings are denoted by "[minor]" at the start of the message,
  578. or "[Minor]" (with a capital "M") for warnings that affect processing when
  579. ignored.</td>
  580. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  581. <tr><td>Lang</td><td><a name="Lang"></a>Localized language for exiftool tag descriptions, etc. If the
  582. specified language isn't available, the option is not changed. May be set to
  583. undef to select the built-in default language.</td>
  584. <td align=left>Image::ExifTool::Lang module name (eg. 'fr', 'zh_cn'), or 'en' or undef for the default language.</td>
  585. <td align=center>'en'</td></tr>
  586. <tr><td>LargeFileSupport</td><td><a name="LargeFileSupport"></a>Flag to indicate that 64-bit file offsets are supported on this system.</td>
  587. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  588. <tr><td>List</td><td><a name="List"></a>Flag to extract lists of PrintConv values into arrays instead of combining
  589. them into a string of values.</td><td align=center>0 or 1</td><td align=center>undef</td></tr>
  590. <tr><td>ListItem</td><td><a name="ListItem"></a>Return only a specific item from
  591. List-type values. A value of 0 returns the first item in each list, 1 returns
  592. the second item, etc. Negative indices may also be used, with -1 representing the
  593. last item in the list. Applies only to the top-level list of nested lists.</td>
  594. <td align=center>An integer, or undef</td><td align=center>undef</td></tr>
  595. <tr><td>ListSep</td><td><a name="ListSep"></a>Separator string used to join lists of PrintConv values when
  596. List option is not set.</td><td align=center>Any string</td><td align=center>', '</td></tr>
  597. <tr><td>ListSplit</td><td><a name="ListSplit"></a>Regular expression used to split values of list-type tags
  598. into individual items when writing. (eg. use ',\\s*' to split a comma-separated list)</td>
  599. <td align=center>A regular expression pattern</td><td align=center>undef</td></tr>
  600. <tr><td>MakerNotes</td><td><a name="MakerNotes"></a>Option to extract MakerNotes and other writable
  601. subdirectories (such as PrintIM) as a data block. Normally when the MakerNotes
  602. are extracted they are rebuilt to include data outside the boundaries of the
  603. original maker note data block, but a value of 2 disables this feature.</td>
  604. <td><table class=clear>
  605. <tr><td valign=top align=center><b>0</b>&nbsp;=</td><td>Don't extract writable subdirectories</td></tr>
  606. <tr><td valign=top align=center><b>1</b>&nbsp;=</td><td>Extract and rebuild makernotes into self-contained block</td></tr>
  607. <tr><td valign=top align=center><b>2</b>&nbsp;=</td><td>Extract without rebuilding makernotes</td></tr>
  608. </table></td><td align=center>undef</td></tr>
  609. <tr><td>MDItemTags</td><td><a name="MDItemTags"></a>Flag to extract the OS X
  610. metadata item tags (see the "mdls" man page for details).</td>
  611. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  612. <tr><td>MissingTagValue</td><td><a name="MissingTagValue"></a>Value for missing tags in
  613. expressions evaluated by <a href="#SetNewValuesFromFile">SetNewValuesFromFile</a>.
  614. If not set, a minor error is issued for missing values, or the value
  615. is set to '' if IgnoreMinorErrors is set.</td>
  616. <td align=center>Any string, or undef</td><td align=center>undef</td></tr>
  617. <tr><td>NoPDFList</td><td><a name="NoPDFList"></a>Flag to avoid splitting PDF List-type tag
  618. values into separate items.</td>
  619. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  620. <tr><td>Password</td><td><a name="Password"></a><a name="Passwd"></a>Password for reading/writing
  621. password-protected PDF documents. Ignored if a password is not required. Character encoding of
  622. the password is determined by the value of the Charset option at processing time.</td>
  623. <td align=center>Any string</td><td align=center>undef</td></tr>
  624. <tr><td>PNGEarlyXMP</td><td><a name="PNGEarlyXMP"></a>Flag to write XMP in PNG
  625. images before the IDAT (image data) chunk. By default, ExifTool adds new
  626. XMP to the end of a PNG file (just before IEND). This is allowed by the PNG
  627. and XMP specifications, but some utilities seem to ignore XMP if it comes
  628. after the image data. The PNGEarlyXMP option causes ExifTool to instead add
  629. new XMP before the PNG IDAT chunk. However, since ExifTool uses a
  630. single-pass writing algorithm, it has no way to tell if XMP already exists
  631. later in the file before writing the new XMP in this location. If this
  632. happens, a minor error is issued when the extra XMP is encountered, and the
  633. file is not written. Adding the <a href="#IgnoreMinorErrors">IgnoreMinorErrors</a>
  634. option causes the XMP after IDAT to be deleted, thus resolving the conflict
  635. (at the expense of possible metadata loss), and allowing the file to be
  636. written. The PNGEarlyXMP option is applied automatically when deleting all
  637. XMP and writing new XMP back in one step. When reading, this option causes
  638. a warning to be issued if standard XMP is found after the IDAT chunk.</td>
  639. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  640. <tr><td>PrintConv</td><td><a name="PrintConv"></a>Flag to enable print conversion. Also enables inverse print
  641. conversion for writing.</td><td align=center>0 or 1</td><td align=center>1</td></tr>
  642. <tr><td>QuickTimeUTC</td><td><a name="QuickTimeUTC"></a>Flag set to assume that QuickTime
  643. date/time values are stored as UTC, causing conversion to local time when they are
  644. extracted. According to the QuickTime specification date/time values should be UTC,
  645. but many digital cameras store local time instead (presumably because they don't know
  646. the time zone). This option also disables the autodetection of incorrect time-zero
  647. offsets in QuickTime date/time values, and enforces a time zero of 1904 as per the
  648. QuickTime specification.</td><td align=center>0 or 1</td><td align=center>undef</td></tr>
  649. <tr><td>RequestAll</td><td><a name="RequestAll"></a>Flag to request all tags to be extracted.
  650. This causes some tags to be generated which normally would not be unless specifically
  651. requested (by passing the tag name to <a href="#ImageInfo">ImageInfo</a> or
  652. <a href="#ExtractInfo">ExtractInfo</a>). Note that this flag is set automatically
  653. during a call to <a href="#SetNewValuesFromFile">SetNewValuesFromFile</a> to
  654. make all tags available for copying.</td><td align=center>0 or 1</td><td align=center>undef</td></tr>
  655. <tr><td>RequestTags</td><td><a name="RequestTags"></a>List of additional tags to request in
  656. next call to <a href="#ExtractInfo">ExtractInfo</a>. This option is useful only for
  657. tags which aren't extracted unless specifically requested.</td><td>List reference,
  658. delimited string of tag names (any delimiter is allowed), or undef to clear the
  659. previous RequestTags list. Case is not significant.</td><td align=center>undef</td></tr>
  660. <tr><td>ScanForXMP</td><td><a name="ScanForXMP"></a>Flag to scan all files (even unrecognized
  661. formats) for XMP information unless XMP was already found in the file. When combined with
  662. the FastScan option, only unrecognized file types are scanned for XMP.
  663. </td><td align=center>0 or 1</td><td align=center>undef</td></tr>
  664. <tr><td>Sort</td><td>Specifies order to sort tags in the returned tag list.</td>
  665. <td><a name="Sort"></a><table class=clear>
  666. <tr><td valign=top align=right><b>Input</b>&nbsp;=</td><td>Sort in same order as input tag arguments</td></tr>
  667. <tr><td valign=top align=right><b>File</b>&nbsp;=</td><td>Sort in order that tags were found in the file</td></tr>
  668. <tr><td valign=top align=right><b>Tag</b>&nbsp;=</td><td>Sort alphabetically by tag name</td></tr>
  669. <tr><td valign=top align=right><b>Descr</b>&nbsp;=</td><td>Sort by tag description (with current Lang setting)</td></tr>
  670. <tr valign=top><td valign=top align=right><b>Group#</b>&nbsp;=</td><td>Sort by tag group,
  671. where # is zero or more family numbers separated by colons. If # is not specified,
  672. Group0 is assumed. See <a href="#GetGroup">GetGroup</a> for a description of group
  673. families.</td></tr>
  674. </table></td><td align=center>'Input'</td></tr>
  675. <tr><td>Sort2</td><td>Secondary sort order used for tags within each group when Sort is 'Group'.</td>
  676. <td><a name="Sort2"></a><table class=clear>
  677. <tr><td valign=top align=right><b>File</b>&nbsp;=</td><td>Sort in order that tags were found in the file</td></tr>
  678. <tr><td valign=top align=right><b>Tag</b>&nbsp;=</td><td>Sort alphabetically by tag name</td></tr>
  679. <tr><td valign=top align=right><b>Descr</b>&nbsp;=</td><td>Sort by tag description (with current Lang setting)</td></tr>
  680. </table></td><td align=center>'File'</td></tr>
  681. <tr><td>StrictDate</td><td><a name="StrictDate"></a>Flag to return undefined value for any date which can't be
  682. converted when the DateFormat option is used.</td>
  683. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  684. <tr><td>Struct</td><td>Flag to return XMP structures as HASH references
  685. instead of flattening into individual tags. This setting has no effect
  686. when writing since both flattened or structured tags may always be written.
  687. See the <a href="struct.html">Structured Information documentation</a> for
  688. more details about structured information.</td>
  689. <td><a name="Struct"></a><table class=clear>
  690. <tr><td valign=top align=right><b>undef</b>&nbsp;=</td><td>Same as 0 for reading and 2 for copying</td></tr>
  691. <tr><td valign=top align=right><b>0</b>&nbsp;=</td><td>Read/copy flattened tags</td></tr>
  692. <tr><td valign=top align=right><b>1</b>&nbsp;=</td><td>Read/copy structures</td></tr>
  693. <tr><td valign=top align=right><b>2</b>&nbsp;=</td><td>Read/copy both flattened and structured tags,
  694. but flag flattened tags as "unsafe" for copying</td></tr>
  695. </table></td><td align=center>undef</td></tr>
  696. <tr><td>SystemTags</td><td><a name="SystemTags"></a>Flag to extract the
  697. following additional File System tags: FileAttributes, FileDeviceNumber,
  698. FileInodeNumber, FileHardLinks, FileUserID, FileGroupID, FileDeviceID,
  699. FileBlockSize and FileBlockCount.</td>
  700. <td align=center>0 or 1</td><td align=center>undef</td></tr>
  701. <tr><td>TextOut</td><td><a name="TextOut"></a>Output file for Verbose and HtmlDump options.</td>
  702. <td align=center>File reference</td><td align=center>\*STDOUT</td></tr>
  703. <tr><td>Unknown</td><td><a name="Unknown"></a>Control extraction of unknown tags.</td>
  704. <td><table class=clear>
  705. <tr><td valign=top align=center><b>0</b>&nbsp;=</td><td>Unknown tags not extracted</td></tr>
  706. <tr><td valign=top align=center><b>1</b>&nbsp;=</td><td>Unknown tags are extracted from EXIF
  707. (and other tagged-format) directories</td></tr>
  708. <tr><td valign=top align=center><b>2</b>&nbsp;=</td><td>Unknown tags also extracted from binary data blocks</td></tr>
  709. </table></td><td align=center>0</td></tr>
  710. <tr><td>UserParam</td><td><a name="UserParam"></a>Special option to set/get user-defined parameters.
  711. Useful to allow external input into tag name expressions and ValueConv logic.
  712. <i>PARAM</i> is the user-defined parameter name (case insensitive). These parameters
  713. may be accessed in tag name expressions by prefixing the parameter name with a dollar
  714. sign, just like normal tags. If called without a parameter name,
  715. <code>Options('UserParam')</code> returns a reference to the hash of all user
  716. parameters (with lower-case names).
  717. </td>
  718. <td><table class=clear>
  719. <tr><td valign=top><i>PARAM</i></td><td>- Get parameter</td></tr>
  720. <tr><td valign=top><i>PARAM=</i></td><td>- Clear parameter</td></tr></table>
  721. <table class=clear>
  722. <tr><td valign=top><i>PARAM=VALUE</i></td><td>- Set parameter</td></tr>
  723. </table></td><td align=center>{ }</td></tr>
  724. <tr><td>Verbose</td><td>Print verbose messages to file specified by TextOut option.
  725. <a href="verbose.html">Click here</a> for example outputs.</td>
  726. <td><a name="Verbose"></a><table class=clear>
  727. <tr><td valign=top align=center><b>0</b>&nbsp;=</td><td>No verbose messages</td></tr>
  728. <tr><td valign=top align=center><b>1</b>&nbsp;=</td><td>Print tag names and raw values</td></tr>
  729. <tr><td valign=top align=center><b>2</b>&nbsp;=</td><td>Add additional tag details</td></tr>
  730. <tr><td valign=top align=center><b>3</b>&nbsp;=</td><td>Add hex dump of tag data (with length limits)</td></tr>
  731. <tr><td valign=top align=center><b>4</b>&nbsp;=</td><td>Remove length limit on dump of tag values</td></tr>
  732. <tr><td valign=top align=center><b>5</b>&nbsp;=</td><td>Remove length limit on dump of JPEG segments</td></tr>
  733. </table></td><td align=center>0</td></tr>
  734. <tr><td>WriteMode</td><td>Set tag write/create mode.</td>
  735. <td><a name="WriteMode"></a>A string with one or more of these characters:<table class=clear>
  736. <tr><td valign=top align=center><b>w</b>&nbsp;=</td><td><b>W</b>rite existing tags</td></tr>
  737. <tr><td valign=top align=center><b>c</b>&nbsp;=</td><td><b>C</b>reate new tags</td></tr>
  738. <tr><td valign=top align=center><b>g</b>&nbsp;=</td><td>Create new <b>g</b>roups <sup>&dagger;</sup></td></tr>
  739. </table></td><td align=center>'wcg'</td></tr>
  740. <tr><td>XMPAutoConv</td><td><a name="XMPAutoConv"></a>Flag to enable automatic conversion
  741. for unknown XMP tags with values that look like rational numbers or dates.</td>
  742. <td align=center>0 or 1</td>
  743. <td align=center>1</td></tr>
  744. </table></blockquote>
  745. <blockquote><table><tr><td valign=top><sup>&dagger;</sup></td><td>The level of
  746. the group differs for different types of metadata. For XMP or IPTC this is the
  747. full XMP/IPTC block (the family 0 group), but for EXIF this is the individual
  748. IFD (the family 1 group).</td></tr></table></blockquote>
  749. <p><b>Examples:</b></p>
  750. <blockquote><table class='box'><tr><td><pre>
  751. <span class=com># exclude the 'OwnerName' tag from returned information</span>
  752. $exifTool-&gt;<b>Options</b>(Exclude =&gt; 'OwnerName');
  753. </pre></td></tr></table></blockquote>
  754. <blockquote><table class='box'><tr><td><pre>
  755. <span class=com># only get information in EXIF or MakerNotes groups</span>
  756. $exifTool-&gt;<b>Options</b>(Group0 =&gt; ['EXIF', 'MakerNotes']);
  757. </pre></td></tr></table></blockquote>
  758. <blockquote><table class='box'><tr><td><pre>
  759. <span class=com># ignore information from IFD1</span>
  760. $exifTool-&gt;<b>Options</b>(Group1 =&gt; '-IFD1');
  761. </pre></td></tr></table></blockquote>
  762. <blockquote><table class='box'><tr><td><pre>
  763. <span class=com># sort by groups in family 2, and extract unknown tags</span>
  764. $exifTool-&gt;<b>Options</b>(Sort =&gt; 'Group2', Unknown =&gt; 1);
  765. </pre></td></tr></table></blockquote>
  766. <blockquote><table class='box'><tr><td><pre>
  767. <span class=com># reset DateFormat option</span>
  768. $exifTool-&gt;<b>Options</b>(DateFormat =&gt; undef);
  769. </pre></td></tr></table></blockquote>
  770. <blockquote><table class='box'><tr><td><pre>
  771. <span class=com># do not extract duplicate tag names</span>
  772. $oldSetting = $exifTool-&gt;<b>Options</b>(Duplicates =&gt; 0);
  773. </pre></td></tr></table></blockquote>
  774. <blockquote><table class='box'><tr><td><pre>
  775. <span class=com># get current Verbose setting</span>
  776. $isVerbose = $exifTool-&gt;<b>Options</b>('Verbose');
  777. </pre></td></tr></table></blockquote>
  778. <blockquote><table class='box'><tr><td><pre>
  779. <span class=com># set a user parameter</span>
  780. $exifTool-&gt;<b>Options</b>(UserParam => 'MyParam=some value');
  781. </pre></td></tr></table></blockquote>
  782. <hr><h2><a name="ClearOptions">ClearOptions</a></h2>
  783. <p>Reset all options to their default values. Loads user-defined default
  784. option values from the %Image::ExifTool::UserDefined::Options hash in
  785. the .ExifTool_config file if it exists.</p>
  786. <blockquote><table class='norm'>
  787. <tr><td><b>Prototype</b></td><td>ClearOptions()</td></tr>
  788. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  789. </td></tr>
  790. </table></blockquote>
  791. <hr><h2><a name="ExtractInfo">ExtractInfo</a></h2>
  792. <p>Extract all meta information from an image.</p>
  793. <blockquote><table class='norm'>
  794. <tr><td><b>Prototype</b></td><td>ExtractInfo($;@)</td></tr>
  795. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  796. <br><b>1-N)</b> Same as <a href="#ImageInfo">ImageInfo</a> except that a list of tag
  797. keys is not returned if an ARRAY reference is given.
  798. </td></tr>
  799. <tr><td valign=top><b>Returns</b></td><td>1 if this was a recognized file format, 0 otherwise</td></tr>
  800. </table></blockquote>
  801. <p><b>Example:</b></p>
  802. <blockquote><table class='box'><tr><td><pre>
  803. $success = $exifTool-&gt;<b>ExtractInfo</b>('image.jpg', \%options);
  804. </pre></td></tr></table></blockquote>
  805. <p>The following options are effective in the call to <a href="#ExtractInfo">ExtractInfo</a>:</p>
  806. <blockquote>
  807. Binary, Charset, CharsetEXIF, CharsetFileName, CharsetID3, CharsetIPTC,
  808. CharsetQuickTime, Composite, ExtendedXMP, ExtractEmbedded, FastScan,
  809. FixBase, HtmlDump, HtmlDumpBase, IgnoreMinorErrors, Lang, LargeFileSupport,
  810. MakerNotes, NoPDFList, PNGEarlyXMP, ScanForXMP, Struct, SystemTags, TextOut,
  811. Unknown and Verbose.
  812. </blockquote>
  813. <hr><h2><a name="GetInfo">GetInfo</a></h2>
  814. <p><a href="#GetInfo">GetInfo</a> is called to return meta information
  815. after it has been extracted from the image by a previous call to
  816. <a href="#ExtractInfo">ExtractInfo</a> or <a href="#ImageInfo">ImageInfo</a>.
  817. This function may be called repeatedly after a single call to
  818. <a href="#ExtractInfo">ExtractInfo</a> or <a href="#ImageInfo">ImageInfo</a>.</p>
  819. <blockquote><table class='norm'>
  820. <tr><td><b>Prototype</b></td><td>GetInfo($;@)</td></tr>
  821. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  822. <br><b>1-N)</b> Same as <a href="#ImageInfo">ImageInfo</a> except that an image
  823. can not be specified
  824. </td></tr>
  825. <tr><td valign=top><b>Returns</b></td><td>Reference to information hash, the same as with
  826. <a href="#ImageInfo">ImageInfo</a></td></tr>
  827. </table></blockquote>
  828. <p><b>Examples:</b></p>
  829. <blockquote><table class='box'><tr><td><pre>
  830. <span class=com># get image width and height only</span>
  831. $info = $exifTool-&gt;<b>GetInfo</b>('ImageWidth', 'ImageHeight');
  832. </pre></td></tr></table></blockquote>
  833. <blockquote><table class='box'><tr><td><pre>
  834. <span class=com># get all Error and Warning messages</span>
  835. $info = $exifTool-&gt;<b>GetInfo</b>('Error', 'Warning');
  836. </pre></td></tr></table></blockquote>
  837. <blockquote><table class='box'><tr><td><pre>
  838. <span class=com># get information for all tags in list (list updated with tags found)</span>
  839. $info = $exifTool-&gt;<b>GetInfo</b>(\@ioTagList);
  840. </pre></td></tr></table></blockquote>
  841. <blockquote><table class='box'><tr><td><pre>
  842. <span class=com># get all information in Author or Location groups</span>
  843. $info = $exifTool-&gt;<b>GetInfo</b>({Group2 =&gt; ['Author', 'Location']});
  844. </pre></td></tr></table></blockquote>
  845. <p>The following options are effective in the call to <a href="#GetInfo">GetInfo</a>:</p>
  846. <blockquote>
  847. Charset, CoordFormat, DateFormat, Duplicates, Escape, Exclude, Filter, Group#,
  848. GlobalTimeShift, Lang, List, ListItem, ListSep, PrintConv, Sort (if a tag
  849. list reference is given) and StrictDate.
  850. </blockquote>
  851. <hr><h2><a name="WriteInfo">WriteInfo</a></h2>
  852. <p>Write meta information to a file. The specified source file is rewritten to
  853. the same-type destination file with new information as specified by previous
  854. calls to <a href="#SetNewValue">SetNewValue</a>. The necessary segments and/or
  855. directories are created in the destination file as required to store the
  856. specified information. May be called repeatedly to write the same information
  857. to additional files without the need to call <a href="#SetNewValue">SetNewValue</a>
  858. again.</p>
  859. <blockquote><table class='norm'>
  860. <tr><td><b>Prototype</b></td><td>WriteInfo($$;$$)</td></tr>
  861. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  862. <br><b>1)</b> Source file name, file reference, scalar reference, or undef to
  863. create a file from scratch. A reference to a File::RandomAccess object is
  864. also allowed as a source, but in this case the destination is not optional.
  865. <br><b>2)</b> [<i>optional</i>] Destination file name, file reference, scalar
  866. reference, or undef to overwrite the original file. May be '-' to write to
  867. stdout.
  868. <br><b>3)</b> [<i>optional</i>] Destination file type. Ignored if a source
  869. is defined.
  870. </td></tr>
  871. <tr><td valign=top><b>Returns</b></td><td>1 if file was written OK, 2 if file was written
  872. but no changes made, 0 on file write error.
  873. </td></tr>
  874. </table></blockquote>
  875. <p>The source file name may be undefined to create a file from scratch
  876. (currently only XMP, MIE, ICC, VRD, DR4, EXV and EXIF files can be created
  877. in this way -- see <a href="#CanCreate">CanCreate</a> for details).
  878. If undefined, the destination file type is required unless the type can be
  879. determined from the extension of the destination file name.</p>
  880. <p>If a destination file name is given, the specified file must not exist
  881. because an existing destination file will not be overwritten. Any new
  882. values for FileName, Directory or HardLink are ignored when a destination
  883. file name is specified.</p>
  884. <p>The destination file name may be undefined to overwrite the original file
  885. (make sure you have backups!). In this case, if a source file name is
  886. provided, a temporary file is created and renamed to replace the source file
  887. if no errors occurred while writing. Otherwise, if a source file reference
  888. or scalar reference is used, the image is first written to memory then
  889. copied back to replace the original if there were no errors.</p>
  890. <p>On Mac OS systems, the file resource fork is preserved if this routine
  891. is called with a source file name.</p>
  892. <p><b>Examples:</b></p>
  893. <blockquote><table class='box'><tr><td><pre>
  894. <span class=com># add information to a source file, writing output to new file</span>
  895. my $result = $exifTool-&gt;<b>WriteInfo</b>($srcfile, $dstfile);
  896. </pre></td></tr></table></blockquote>
  897. <blockquote><table class='box'><tr><td><pre>
  898. <span class=com># create XMP data file from scratch</span>
  899. $exifTool-&gt;<b>WriteInfo</b>(undef, $dstfile, 'XMP');
  900. </pre></td></tr></table></blockquote>
  901. <blockquote><table class='box'><tr><td><pre>
  902. <span class=com># overwrite file (you do have backups, right?)</span>
  903. $exifTool-&gt;<b>WriteInfo</b>($srcfile);
  904. </pre></td></tr></table></blockquote>
  905. <blockquote><table class='box'><tr><td><pre>
  906. <span class=com># retrieve error and warning messages</span>
  907. $errorMessage = $exifTool-&gt;<a href="#GetValue">GetValue</a>('Error');
  908. $warningMessage = $exifTool-&gt;<a href="#GetValue">GetValue</a>('Warning');
  909. </pre></td></tr></table></blockquote>
  910. <p>If an error code is returned, an Error tag is set and GetValue('Error') can
  911. be called to obtain the error description. A Warning tag may be set even if
  912. this routine is successful. Calling WriteInfo clears any pre-existing Error
  913. and Warning tags.</p>
  914. <p>The following ExifTool options are effective in the call to
  915. <a href="#WriteInfo">WriteInfo</a>:</p>
  916. <blockquote>
  917. ByteOrder, Charset, CharsetEXIF, CharsetFileName, CharsetIPTC, Compact,
  918. Compress, FixBase, IgnoreMinorErrors, PNGEarlyXMP and Verbose.
  919. </blockquote>
  920. <hr><h2><a name="GetTagList">GetTagList</a></h2>
  921. <p>Get a sorted list of tags from the specified information hash or tag list.</p>
  922. <blockquote><table class='norm'>
  923. <tr><td><b>Prototype</b></td><td>GetTagList($;$$$)</td></tr>
  924. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  925. <br><b>1)</b> [<i>optional</i>] Reference to info hash or tag list
  926. <br><b>2)</b> [<i>optional</i>] Sort order ('Input', 'File', 'Tag', 'Descr' or 'Group#')
  927. <br><b>3)</b> [<i>optional</i>] Secondary sort order ('File', 'Tag' or 'Descr')
  928. </td></tr>
  929. <tr><td valign=top><b>Returns</b></td><td>List of tag keys in specified order</td></tr>
  930. </table></blockquote>
  931. <p><b>Example:</b></p>
  932. <blockquote><table class='box'><tr><td><pre>
  933. @tags = $exifTool-&gt;<b>GetTagList</b>($info, 'Group0');
  934. </pre></td></tr></table></blockquote>
  935. <p>If the information hash or tag list reference is not provided, then the list
  936. of found tags from the last call to <a href="#ImageInfo">ImageInfo</a>,
  937. <a href="#ExtractInfo">ExtractInfo</a> or <a href="#GetInfo">GetInfo</a>
  938. is used instead, and the result is the same as if
  939. <a href="#GetFoundTags">GetFoundTags</a> was called. If sort order is not
  940. specified, the sort order is taken from the current options settings.</p>
  941. <hr><h2><a name="GetFoundTags">GetFoundTags</a></h2>
  942. <p>Get list of found tags in specified sort order. The found tags are the
  943. tags for the information obtained from the most recent call to
  944. <a href="#ImageInfo">ImageInfo</a>, <a href="#ExtractInfo">ExtractInfo</a>
  945. or <a href="#GetInfo">GetInfo</a> for this object.</p>
  946. <blockquote><table class='norm'>
  947. <tr><td><b>Prototype</b></td><td>GetFoundTags($;$$)</td></tr>
  948. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  949. <br><b>1)</b> [<i>optional</i>] Sort order ('Input', 'File', 'Tag', 'Descr' or 'Group#')
  950. <br><b>2)</b> [<i>optional</i>] Secondary sort order ('File', 'Tag' or 'Descr')
  951. </td></tr>
  952. <tr><td valign=top><b>Returns</b></td><td>List of tag keys in the specified order</td></tr>
  953. </table></blockquote>
  954. <p><b>Example:</b></p>
  955. <blockquote><table class='box'><tr><td><pre>
  956. my @tags = $exifTool-&gt;<b>GetFoundTags</b>('File');
  957. </pre></td></tr></table></blockquote>
  958. <hr><h2><a name="GetRequestedTags">GetRequestedTags</a></h2>
  959. <p>Get list of requested tags. These are the tags that were specified
  960. in the arguments of the most recent call to <a href="#ImageInfo">ImageInfo</a>,
  961. <a href="#ExtractInfo">ExtractInfo</a> or <a href="#GetInfo">GetInfo</a>,
  962. including tags specified via a tag list reference. They are returned
  963. in the same order that they were specified. Shortcut tags are expanded
  964. in the list.</p>
  965. <blockquote><table class='norm'>
  966. <tr><td><b>Prototype</b></td><td>GetRequestedTags($)</td></tr>
  967. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  968. </td></tr>
  969. <tr><td valign=top><b>Returns</b></td><td>List of tag keys for requested tags
  970. (empty if no tags specifically requested)</td></tr>
  971. </table></blockquote>
  972. <p><b>Example:</b></p>
  973. <blockquote><table class='box'><tr><td><pre>
  974. my @requestedTags = $exifTool-&gt;<b>GetRequestedTags</b>();
  975. </pre></td></tr></table></blockquote>
  976. <hr><h2><a name="GetValue">GetValue</a></h2>
  977. <p>Get the value of a specified tag. The returned value is either the
  978. human-readable (PrintConv) value, the converted machine-readable (ValueConv)
  979. value, or the original raw (Raw) value. If the value type is not specified,
  980. the PrintConv value is returned if the PrintConv option is set, otherwise the
  981. ValueConv value is returned. The PrintConv values are the same as the values
  982. returned by <a href="#ImageInfo">ImageInfo</a> and <a href="#GetInfo">GetInfo</a>
  983. in the tag/value hash unless the PrintConv option is disabled.</p>
  984. <p>Tags which represent lists of multiple values (as may happen with
  985. '<code>Keywords</code>' for example) are handled specially. In scalar context,
  986. the returned PrintConv value for these tags is either a string of values or
  987. a list reference (depending on the List option setting), and the ValueConv
  988. value is always a list reference. But in list context,
  989. <a href="#GetValue">GetValue</a> always returns the list itself.</p>
  990. <p>Note that <a href="#GetInfo">GetValue</a> requires a case-sensitive tag key
  991. as an argument. To retrieve tag information based on a case-insensitive tag name
  992. (with an optional group specifier), use <a href="#GetInfo">GetInfo</a>
  993. instead.</p>
  994. <blockquote><table class='norm'>
  995. <tr><td><b>Prototype</b></td><td>GetValue($$;$)</td></tr>
  996. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  997. <br><b>1)</b> Tag key
  998. <br><b>2)</b> [<i>optional</i>] Value type, 'PrintConv', 'ValueConv', 'Both',
  999. 'Raw' or 'Rational'
  1000. <br>&nbsp;<br>The default value type is 'PrintConv' if the PrintConv option
  1001. is set, otherwise the default is 'ValueConv'. A value type of 'Both'
  1002. returns both ValueConv and PrintConv values as a list. 'Rational' returns
  1003. the raw rational value as a string fraction for rational types, or undef for
  1004. other types.
  1005. </td></tr>
  1006. <tr><td valign=top><b>Returns</b></td><td>
  1007. The value of the specified tag. If the tag represents a list of multiple values
  1008. and the List option is disabled then PrintConv returns a string of values,
  1009. otherwise a reference to the list is returned in scalar context. The list
  1010. itself is returned in list context. (Unless 'Both' values are requested, in
  1011. which case two list references are returned, regardless of context.) Values may
  1012. also be scalar references to binary data, or hash references if the
  1013. <a href="#Struct">Struct</a> option is set.<br>&nbsp;<br> Note: It is possible
  1014. for <a href="#GetValue">GetValue</a> to return an undefined ValueConv or
  1015. PrintConv value (or an empty list in list context) even if the tag exists, since
  1016. it is possible for these conversions to yield undefined values. And the
  1017. Rational value will be undefined for any non-rational tag. The Raw value should
  1018. always exist if the tag exists.
  1019. </td></tr>
  1020. </table></blockquote>
  1021. <p><b>Examples:</b></p>
  1022. <blockquote><table class='box'><tr><td><pre>
  1023. <span class=com># PrintConv example</span>
  1024. my $val = $exifTool-&gt;<b>GetValue</b>($tag);
  1025. if (ref $val eq 'SCALAR') {
  1026. print "$tag = (unprintable value)\n";
  1027. } else {
  1028. print "$tag = $val\n";
  1029. }
  1030. </pre></td></tr></table></blockquote>
  1031. <blockquote><table class='box'><tr><td><pre>
  1032. <span class=com># ValueConv example</span>
  1033. my $val = $exifTool-&gt;<b>GetValue</b>($tag, 'ValueConv');
  1034. if (ref $val eq 'ARRAY') {
  1035. print "$tag is a list of values\n";
  1036. } elsif (ref $val eq 'SCALAR') {
  1037. print "$tag represents binary data\n";
  1038. } else {
  1039. print "$tag is a simple scalar\n";
  1040. }
  1041. </pre></td></tr></table></blockquote>
  1042. <blockquote><table class='box'><tr><td><pre>
  1043. <span class=com># list example</span>
  1044. my @keywords = $exifTool-&gt;<b>GetValue</b>('Keywords', 'ValueConv');
  1045. </pre></td></tr></table></blockquote>
  1046. <p>The following options are in effect when <a href="#GetValue">GetValue</a> is
  1047. called:</p>
  1048. <blockquote>
  1049. Charset, CoordFormat, DateFormat, Escape, Filter, GlobalTimeShift, Lang, List,
  1050. ListItem, ListSep, PrintConv and StrictDate.
  1051. </blockquote>
  1052. <hr><h2><a name="SetNewValue">SetNewValue</a></h2>
  1053. <p>Set the new value for a tag. The routine may be called multiple times to set
  1054. the values of many tags before using <a href="#WriteInfo">WriteInfo</a> to write
  1055. the new values to an image.</p>
  1056. <p>For list-type tags (like <code>Keywords</code>), either call repeatedly with
  1057. the same tag name for each value, or call with a reference to the list of values.</p>
  1058. <blockquote><table class='norm'>
  1059. <tr><td><b>Prototype</b></td><td>SetNewValue($;$$%)</td></tr>
  1060. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1061. <br><b>1)</b> [<i>optional</i>] Tag key or tag name, or undef to clear all new
  1062. values. The tag name may be prefixed one or more family 0, 1 or 2 group
  1063. names with optional leading family numbers, separated by colons (eg.
  1064. '<code>EXIF:Artist</code>', '<code>XMP:Time:*</code>'), which is equivalent
  1065. to using a Group option argument. Also, a '<code>#</code>' may be appended
  1066. to the tag name (eg. '<code>EXIF:Orientation#</code>'), with the same effect
  1067. as setting Type to 'ValueConv'. Wildcards ('<code>*</code>' and
  1068. '<code>?</code>') may be used in the tag name to assign multiple tags
  1069. simultaneously A tag name of '<code>*</code>' is special when deleting
  1070. information, and will delete an entire group even if some individual tags in
  1071. the group are not writable, but only if a single family 0 or 1 group name is
  1072. specified (otherwise, the tags are deleted individually). Use
  1073. <a href="#GetDeleteGroups">GetDeleteGroups</a> to get a list of deletable group
  1074. names, and see the <a href="TagNames/index.html">TagNames documentation</a>
  1075. for a complete list of ExifTool tag names.
  1076. <br><b>2)</b> [<i>optional</i>] New value for tag. Undefined to delete tag
  1077. from file. May be a scalar, scalar reference, list reference to set a list
  1078. of values, or hash reference for a structure. Integer values may be
  1079. specified as a hexadecimal string (with a leading '0x'), and simple
  1080. rational values may be specified in fractional form (eg. '4/10'). Structure
  1081. tags may be specified either as a hash reference or a serialized string
  1082. (see the last two examples below).
  1083. <br><b>3-N)</b> [<i>optional</i>] SetNewValue option/value pairs (see below).
  1084. </td></tr>
  1085. <tr><td valign=top><b>Returns</b></td><td>Scalar context: The number of tags set, and
  1086. errors are printed to STDERR.
  1087. <br>List context: The number of tags set, and the error string (undefined if no error).
  1088. </td></tr>
  1089. </table></blockquote>
  1090. <blockquote><table class='norm'>
  1091. <tr><th colspan=4 bgcolor='#dddddd'>SetNewValue Options</th></tr>
  1092. <tr><th>Option</th><th>Description</th><th width='30%'>Values</th><th>Default</th></tr>
  1093. <tr><td>AddValue</td><td>Add value to existing list in a file rather than overwriting</td>
  1094. <td><table class=clear>
  1095. <tr><td valign=top align=center><b>0</b>&nbsp;=</td><td>Overwrite existing value(s)</td></tr>
  1096. <tr><td valign=top align=center><b>1</b>&nbsp;=</td><td>Add to existing list, or warn for non-list tags</td></tr>
  1097. <tr><td valign=top align=center><b>2</b>&nbsp;=</td><td>Add to existing list, or overwrite non-list tags</td></tr>
  1098. </table></td><td align=center>0</td></tr>
  1099. <tr><td>DelValue</td><td>Delete existing tag from a file if it has the specified value</td>
  1100. <td align=center>0 or 1</td><td align=center>0</td></tr>
  1101. <tr><td>EditGroup</td><td>Create tags in existing groups only. Don't create new group.
  1102. Effectively removes the 'g' from the ExifTool WriteMode option for this tag only.</td>
  1103. <td align=center>0 or 1</td><td align=center>0</td></tr>
  1104. <tr><td>EditOnly</td><td>Edit tag only if it already exists. Don't create new tag.
  1105. Effectively removes the 'c' from the ExifTool WriteMode option for this tag only.</td>
  1106. <td align=center>0 or 1</td><td align=center>0</td></tr>
  1107. <tr><td>Group</td><td>Specifies group name where tag should be written.
  1108. If not specified, tag is written to highest priority group as specified
  1109. by <a href="#SetNewGroups">SetNewGroups</a>. Case is not significant</td>
  1110. <td align=center>One or more family 0, 1 or 2 groups with optional leading
  1111. family number, separated by colons</td><td align=center>undef</td></tr>
  1112. <tr><td>NoFlat</td><td>Treat flattened tags as 'unsafe'</td><td align=center>0 or 1</td><td align=center>0</td></tr>
  1113. <tr><td>NoShortcut</td><td>Disables default behaviour of looking up tag in
  1114. shortcuts if not found otherwise.</td><td align=center>0 or 1</td><td align=center>0</td></tr>
  1115. <tr><td>Protected</td><td>Allow protected tags to be written</td>
  1116. <td>Bitmask of tag protection levels to write:
  1117. <table class=clear>
  1118. <tr><td valign=top align=center><b>0x01</b>&nbsp;=</td>
  1119. <td>Write '<a href="TagNames/index.html">unsafe</a>' tags (ie. tags not copied
  1120. automatically via <a href="#SetNewValuesFromFile">SetNewValuesFromFile</a>)</td></tr>
  1121. <tr><td valign=top align=center><b>0x02</b>&nbsp;=</td>
  1122. <td>Write '<a href="TagNames/index.html">protected</a>' tags (internal use only)</td></tr>
  1123. </table></td><td align=center>0</td></tr>
  1124. <tr><td>ProtectSaved</td><td>Avoid setting new values which were saved after the Nth
  1125. call to <a href="#SaveNewValues">SaveNewValues</a>. Has no effect on unsaved values,
  1126. or values saved before the Nth call.</td><td align=center>N</td><td align=center>undef</td></tr>
  1127. <tr><td>Replace</td><td>Replace previous new values for this tag (ie. replace the values
  1128. set in previous calls to <a href="#SetNewValue">SetNewValue</a>). This option
  1129. is most commonly used to replace previously-set new values for list-type tags.</td>
  1130. <td><table class=clear>
  1131. <tr><td valign=top align=center><b>0</b>&nbsp;=</td><td>Set new value normally</td></tr>
  1132. <tr><td valign=top align=center><b>1</b>&nbsp;=</td><td>Reset previous new values and replace with the specifed new value</td></tr>
  1133. <tr><td valign=top align=center><b>2</b>&nbsp;=</td><td>Reset previous new values only</td></tr>
  1134. </table></td><td align=center>0</td></tr>
  1135. <tr><td>Shift</td><td>Shift the tag by the specified value. Currently only date/time tags
  1136. and tags with numerical values may be shifted. Value is added if Shift is 1, or subtracted
  1137. if Shift is -1. See <a href="Shift.html">Image::ExifTool::Shift.pl</a> for details time shift formats.</td>
  1138. <td><table class=clear>
  1139. <tr><td valign=top align=left colspan=2><b>undef</b>&nbsp;= No shift</td></tr>
  1140. <tr><td valign=top align=right><b>0</b>&nbsp;=</td><td>Shift if shiftable:<br>
  1141. Positive if AddValue set, or<br>
  1142. Negative if DelValue set and<br>
  1143. tag is date/time</td></tr>
  1144. <tr><td valign=top align=right><b>1</b>&nbsp;=</td><td>Positive shift</td></tr>
  1145. <tr><td valign=top align=right><b>-1</b>&nbsp;=</td><td>Negative shift</td></tr>
  1146. </table></td><td align=center>undef</td></tr>
  1147. <tr><td>Type</td><td>The type of value being set</td>
  1148. <td>PrintConv, ValueConv or Raw (default depends on <a href="#PrintConv">PrintConv</a> Option)</td>
  1149. <td align=center>PrintConv or ValueConv</td></tr>
  1150. </table></blockquote>
  1151. <p><b>Examples:</b></p>
  1152. <blockquote><table class='box'><tr><td><pre>
  1153. <span class=com># set a new value for a tag (errors go to STDERR)</span>
  1154. $success = $exifTool-&gt;<b>SetNewValue</b>($tag, $value);
  1155. </pre></td></tr></table></blockquote>
  1156. <blockquote><table class='box'><tr><td><pre>
  1157. <span class=com># set a new value and capture any error message</span>
  1158. ($success, $errStr) = $exifTool-&gt;<b>SetNewValue</b>($tag, $value);
  1159. </pre></td></tr></table></blockquote>
  1160. <blockquote><table class='box'><tr><td><pre>
  1161. <span class=com># delete information for specified tag if it exists in image
  1162. # (also resets AddValue and DelValue options for this tag)</span>
  1163. $exifTool-&gt;<b>SetNewValue</b>($tag);
  1164. </pre></td></tr></table></blockquote>
  1165. <blockquote><table class='box'><tr><td><pre>
  1166. <span class=com># reset all values from previous calls to SetNewValue()</span>
  1167. $exifTool-&gt;<b>SetNewValue</b>();
  1168. </pre></td></tr></table></blockquote>
  1169. <blockquote><table class='box'><tr><td><pre>
  1170. <span class=com># delete a specific keyword</span>
  1171. $exifTool-&gt;<b>SetNewValue</b>('Keywords', $word, DelValue =&gt; 1);
  1172. </pre></td></tr></table></blockquote>
  1173. <blockquote><table class='box'><tr><td><pre>
  1174. <span class=com># set keywords (a list-type tag) with two new values</span>
  1175. $exifTool-&gt;<b>SetNewValue</b>(Keywords =&gt; 'word1');
  1176. $exifTool-&gt;<b>SetNewValue</b>(Keywords =&gt; 'word2');
  1177. <span class=com># equivalent, but set both in one call using an array reference</span>
  1178. $exifTool-&gt;<b>SetNewValue</b>(Keywords =&gt; ['word1','word2']);
  1179. </pre></td></tr></table></blockquote>
  1180. <blockquote><table class='box'><tr><td><pre>
  1181. <span class=com># add a keyword without replacing existing keywords in the file</span>
  1182. $exifTool-&gt;<b>SetNewValue</b>(Keywords =&gt; $word, AddValue =&gt; 1);
  1183. </pre></td></tr></table></blockquote>
  1184. <blockquote><table class='box'><tr><td><pre>
  1185. <span class=com># set a tag in a specific group</span>
  1186. $exifTool-&gt;<b>SetNewValue</b>(Headline =&gt; $val, Group =&gt; 'XMP');
  1187. $exifTool-&gt;<b>SetNewValue</b>('XMP:Headline' =&gt; $val); <span class=com># (equivalent)</span>
  1188. </pre></td></tr></table></blockquote>
  1189. <blockquote><table class='box'><tr><td><pre>
  1190. <span class=com># shift original date/time back by 2.5 hours</span>
  1191. $exifTool-&gt;<b>SetNewValue</b>(DateTimeOriginal =&gt; '2:30', Shift =&gt; -1);
  1192. </pre></td></tr></table></blockquote>
  1193. <blockquote><table class='box'><tr><td><pre>
  1194. <span class=com># write a tag only if it had a specific value
  1195. # (the order of the following calls is not significant)</span>
  1196. $exifTool-&gt;<b>SetNewValue</b>(Title =&gt; $oldVal, DelValue =&gt; 1);
  1197. $exifTool-&gt;<b>SetNewValue</b>(Title =&gt; $newVal);
  1198. </pre></td></tr></table></blockquote>
  1199. <blockquote><table class='box'><tr><td><pre>
  1200. <span class=com># write tag by numerical value</span>
  1201. $exifTool-&gt;<b>SetNewValue</b>(Orientation =&gt; 6, Type =&gt; 'ValueConv');
  1202. $exifTool-&gt;<b>SetNewValue</b>('Orientation#' =&gt; 6); <span class=com># (equivalent)</span>
  1203. </pre></td></tr></table></blockquote>
  1204. <blockquote><table class='box'><tr><td><pre>
  1205. <span class=com># delete all but EXIF tags</span>
  1206. $exifTool-&gt;<b>SetNewValue</b>('*'); <span class=com># delete all...</span>
  1207. $exifTool-&gt;<b>SetNewValue</b>('EXIF:*', undef, Replace =&gt; 2); <span class=com># ...but EXIF</span>
  1208. </pre></td></tr></table></blockquote>
  1209. <blockquote><table class='box'><tr><td>
  1210. <pre><span class=com># write structured information as a HASH reference</span>
  1211. $exifTool-&gt;<b>SetNewValue</b>('XMP:Flash' =&gt; { mode=>'on', fired=>'true', return=>'not' });</pre>
  1212. </td></tr></table></blockquote>
  1213. <blockquote><table class='box'><tr><td>
  1214. <pre><span class=com># write structured information as a serialized string</span>
  1215. $exifTool-&gt;<b>SetNewValue</b>('XMP:Flash' =&gt; '{mode=on,fired=true,return=not}');</pre>
  1216. </td></tr></table>(see <a href="struct.html#Serialize">struct.html</a> for a
  1217. description of the structure serialization technique)</blockquote>
  1218. <p><b>Notes:</b></p>
  1219. <p>When deleting groups of tags, the Replace option may be used to exclude
  1220. specific groups from a mass delete. However, this technique may not be used to
  1221. exclude individual tags from a group delete (unless a family 2 group was
  1222. specified in the delete). Instead, use
  1223. <a href="#SetNewValuesFromFile">SetNewValuesFromFile</a> to recover the values
  1224. of individual tags after deleting a group.</p>
  1225. <p>When deleting all tags from a JPEG image, the APP14 "Adobe" information is
  1226. not deleted by default because doing so may affect the appearance of the image.
  1227. However, this information may be deleted by specifying it explicitly, either by
  1228. group (with '<code>Adobe:*</code>') or as a block (with '<code>Adobe</code>').</p>
  1229. <p>The following ExifTool options are effective in the call to
  1230. <a href="#SetNewValue">SetNewValue</a>:</p>
  1231. <blockquote>
  1232. Charset, Escape, IgnoreMinorErrors, Lang, ListSep, ListSplit, PrintConv, Verbose
  1233. and WriteMode.
  1234. </blockquote>
  1235. <hr><h2><a name="GetNewValue">GetNewValue</a><a name="GetNewValues"></a></h2>
  1236. <p>Get the new Raw value for a tag. This is the value set by
  1237. <a href="#SetNewValue">SetNewValue</a> that is queued to be written to
  1238. file. List-type tags may return multiple values in list context.</p>
  1239. <blockquote><table class='norm'>
  1240. <tr><td><b>Prototype</b></td><td>GetNewValue($$)</td></tr>
  1241. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1242. <br><b>1)</b> Tag name (case sensitive, may be prefixed by family 0 or 1 group name)
  1243. </td></tr>
  1244. <tr><td valign=top><b>Returns</b></td><td>List of new Raw tag values, or first value in
  1245. list when called in scalar context. The list may be empty either if the tag
  1246. isn't being written, or if it is being deleted (ie. if
  1247. <a href="#SetNewValue">SetNewValue</a> was called without a value).
  1248. </td></tr>
  1249. </table></blockquote>
  1250. <p><b>Examples:</b></p>
  1251. <blockquote><table class='box'><tr><td><pre>
  1252. my $rawVal = $exifTool-&gt;<b>GetNewValue</b>($tag);
  1253. </pre></td></tr></table></blockquote>
  1254. <blockquote><table class='box'><tr><td><pre>
  1255. my @rawVals = $exifTool-&gt;<b>GetNewValue</b>($tag);
  1256. </pre></td></tr></table></blockquote>
  1257. <hr><h2><a name="SetNewValuesFromFile">SetNewValuesFromFile</a></h2>
  1258. <p>A very powerful routine that sets new values for tags from information found
  1259. in a specified file.</p>
  1260. <blockquote><table class='norm'>
  1261. <tr><td><b>Prototype</b></td><td>SetNewValuesFromFile($$;@)</td></tr>
  1262. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1263. <br><b>1)</b> File name, file reference, or scalar reference
  1264. <br><b>2-N)</b> [<i>optional</i>] List of tag names to set or options hash
  1265. references. All writable tags are set if none are specified. The tag names
  1266. are not case sensitive, and may be prefixed by one or more family 0, 1 or 2
  1267. group names with optional leading family numbers, separated by colons (eg.
  1268. '<code>exif:iso</code>'). A leading '<code>-</code>' indicates tags to be
  1269. excluded (eg. '<code>-comment</code>'), or a trailing '<code>#</code>' causes
  1270. the ValueConv value to be copied (same as setting the Type option to
  1271. 'ValueConv' for this tag only). Wildcards ('<code>*</code>' and
  1272. '<code>?</code>') may be used in the tag name. A tag name of '<code>*</code>'
  1273. is commonly used when a group is specified to copy all tags in the group (eg.
  1274. '<code>XMP:*</code>').<br>&nbsp;<br> A special feature allows tag names of the
  1275. form '<code>DSTTAG&lt;SRCTAG</code>' (or '<code>SRCTAG&gt;DSTTAG</code>') to be
  1276. specified to copy information to a tag with a different name or a specified
  1277. group. Both '<code>SRCTAG</code>' and '<code>DSTTAG</code>' may contain
  1278. wildcards and/or be prefixed by a group name (eg.
  1279. '<code>fileModifyDate&lt;modifyDate</code>' or '<code>xmp:*&lt;*</code>'),
  1280. and/or suffixed by a '<code>#</code>' to disable print conversion. Copied tags
  1281. may also be added or deleted from a list with arguments of the form
  1282. '<code>DSTTAG+&lt;SRCTAG</code>' or '<code>DSTTAG-&lt;SRCTAG</code>'. Tags are
  1283. evaluated in order, so exclusions apply only to tags included earlier in the
  1284. list. An extension of this feature allows the tag value to be set from an
  1285. expression containing tag names with leading '<code>$</code>' symbols (eg.
  1286. '<code>Comment&lt;the file is $filename</code>'). Braces '<code>{}</code>' may
  1287. be used around the tag name to separate it from subsequent text, and a
  1288. '<code>$$</code>' is used to to represent a '<code>$</code>' symbol. The
  1289. behaviour for missing tags in expressions is defined by the <a
  1290. href="#MissingTagValue">MissingTagValue</a> option. The tag value may be
  1291. modified via changes to the default input variable (<code>$_</code>) in Perl
  1292. expressions placed inside the braces and after a semicolon following the tag
  1293. name. Braces within the expression must be balanced.
  1294. <br>&nbsp;<br>
  1295. Multiple options hash references may be passed to set different options for
  1296. different tags. Options apply to subsequent tags in the argument list.
  1297. </td></tr>
  1298. <tr><td valign=top><b>Returns</b></td><td>A hash of information that was set
  1299. successfully. May include Warning or Error entries if there were problems
  1300. reading the input file.
  1301. </td></tr>
  1302. </table></blockquote>
  1303. <p>By default, this routine will commute information between same-named tags in
  1304. different groups, allowing information to be translated between images with
  1305. different formats. This behaviour may be modified by specifying a group name
  1306. for extracted tags (even if '<code>*</code>' is used as a group name), in which
  1307. case the information is written to the original group, unless redirected to a
  1308. different group. When '<code>*</code>' is used for a group name, by default the
  1309. family 1 group of the original tag is preserved, but a different family may be
  1310. specified with a leading family number. (For example, specifying
  1311. '<code>*:*</code>' copies all information while preserving the original family 1
  1312. groups, while '<code>0*:*</code>' preserves the family 0 group.)</p>
  1313. <p><b>SetNewValuesFromFile Options:</b></p>
  1314. <p>The options are the same was for <a href="#SetNewValue">SetNewValue</a>, and
  1315. are passed directly to <a href="#SetNewValue">SetNewValue</a> internally,
  1316. with a few exceptions:</p>
  1317. <ul>
  1318. <li>The Replace option defaults to 1 instead of 0 as with
  1319. <a href="#SetNewValue">SetNewValue</a>.</li>
  1320. <li>The AddValue or DelValue option is set for individual tags if '+&gt;' or
  1321. '-&gt;' (or '+&lt;' or '-&lt;') are used.</li>
  1322. <li>The Group option is set for tags where a group name is given.</li>
  1323. <li>The Protected flag is set to 1 for individually specified tags.</li>
  1324. <li>The Type option also applies to extracted tags.</li>
  1325. </ul>
  1326. <p><b>Examples:</b></p>
  1327. <blockquote><table class='box'><tr><td><pre>
  1328. <span class=com># set new values from all information in a file...</span>
  1329. my $info = $exifTool-&gt;<b>SetNewValuesFromFile</b>($srcFile);
  1330. <span class=com># ...then write these values to another image</span>
  1331. my $result = $exifTool-&gt;<a href="#WriteInfo">WriteInfo</a>($file2, $outFile);
  1332. </pre></td></tr></table></blockquote>
  1333. <blockquote><table class='box'><tr><td><pre>
  1334. <span class=com># set all new values, preserving original groups</span>
  1335. $exifTool-&gt;<b>SetNewValuesFromFile</b>($srcFile, '*:*');
  1336. </pre></td></tr></table></blockquote>
  1337. <blockquote><table class='box'><tr><td><pre>
  1338. <span class=com># set specific information</span>
  1339. $exifTool-&gt;<b>SetNewValuesFromFile</b>($srcFile, $tag1, $tag2...);
  1340. </pre></td></tr></table></blockquote>
  1341. <blockquote><table class='box'><tr><td><pre>
  1342. <span class=com># set new value from a different tag in specific group</span>
  1343. $exifTool-&gt;<b>SetNewValuesFromFile</b>($src, 'IPTC:Keywords&gt;XMP-dc:Subject');
  1344. </pre></td></tr></table></blockquote>
  1345. <blockquote><table class='box'><tr><td><pre>
  1346. <span class=com># add all IPTC keywords to XMP subject list</span>
  1347. $exifTool-&gt;<b>SetNewValuesFromFile</b>($src, 'IPTC:Keywords+&gt;XMP-dc:Subject');
  1348. </pre></td></tr></table></blockquote>
  1349. <blockquote><table class='box'><tr><td><pre>
  1350. <span class=com># set new value from an expression involving other tags</span>
  1351. $exifTool-><b>SetNewValuesFromFile</b>($file,
  1352. 'Comment&lt;ISO=$ISO Aperture=$aperture Exposure=$shutterSpeed');
  1353. </pre></td></tr></table></blockquote>
  1354. <blockquote><table class='box'><tr><td><pre>
  1355. <span class=com># set keywords list from the values of multiple tags</span>
  1356. $exifTool-&gt;<b>SetNewValuesFromFile</b>($file, { Replace =&gt; 0 },
  1357. 'keywords&lt;xmp:subject', 'keywords&lt;filename');
  1358. </pre></td></tr></table></blockquote>
  1359. <blockquote><table class='box'><tr><td><pre>
  1360. <span class=com># copy all EXIF information, preserving the original IFD
  1361. # (without '&gt;*.*' tags would be copied to the preferred EXIF IFD)</span>
  1362. $exifTool-&gt;<b>SetNewValuesFromFile</b>($file, 'EXIF:*&gt;*:*');
  1363. </pre></td></tr></table></blockquote>
  1364. <blockquote><table class='box'><tr><td><pre>
  1365. <span class=com># copy all tags with names starting with "gps" (note: this is
  1366. # different than "gps:*" because it will also copy XMP GPS tags)</span>
  1367. $exifTool-&gt;<b>SetNewValuesFromFile</b>($file, 'gps*');
  1368. </pre></td></tr></table></blockquote>
  1369. <blockquote><table class='box'><tr><td><pre>
  1370. <span class=com># set FileName from Model, translating questionable characters to underlines</span>
  1371. $exifTool-&gt;<b>SetNewValuesFromFile</b>($file, 'filename&lt;${model;tr(/\\\\?*:|"&lt;&gt;)(_)}.jpg');
  1372. </pre></td></tr></table></blockquote>
  1373. <p><b>Notes:</b></p>
  1374. <p>The PrintConv option applies to this routine, but it normally should be left
  1375. on to provide more reliable transfer of information between groups.</p>
  1376. <p>If a preview image exists, it is not copied. The preview image must be
  1377. transferred separately if desired, in a separate call to
  1378. <a href="#WriteInfo">WriteInfo</a></p>
  1379. <p>When simply copying all information between files of the same type, it is
  1380. usually desirable to preserve the original groups by specifying
  1381. '<code>*:*</code>' for the tags to set.</p>
  1382. <p>The <a href="#Duplicates">Duplicates</a> option is always in effect for tags
  1383. extracted from the source file using this routine.</p>
  1384. <p>The <a href="#Struct">Struct</a> option is enabled by default for tags
  1385. extracted by this routine. This allows the hierarchy of complex structures to
  1386. be preserved when copying, but the Struct option may be set to 0 to override
  1387. this behaviour and copy as flattened tags instead.</p>
  1388. <hr><h2><a name="CountNewValues">CountNewValues</a></h2>
  1389. <p>Return the total number of new values set.</p>
  1390. <blockquote><table class='norm'>
  1391. <tr><td><b>Prototype</b></td><td>CountNewValues($)</td></tr>
  1392. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1393. </td></tr>
  1394. <tr><td valign=top><b>Returns</b></td><td>In scalar context, returns the total number
  1395. of tags with new values set. In list context, also returns the number of
  1396. "pseudo" tag values which have been set. "Pseudo" tags are tags like FileName
  1397. and FileModifyDate which are not contained within the file and can be changed
  1398. without rewriting the file.</td></tr>
  1399. </table></blockquote>
  1400. <p><b>Examples:</b></p>
  1401. <blockquote><table class='box'><tr><td><pre>
  1402. my $numSet = $exifTool-&gt;<b>CountNewValues</b>();
  1403. </pre></td></tr></table></blockquote>
  1404. <blockquote><table class='box'><tr><td><pre>
  1405. my ($numSet, $numPseudo) = $exifTool-&gt;<b>CountNewValues</b>();
  1406. </pre></td></tr></table></blockquote>
  1407. <hr><h2><a name="SaveNewValues">SaveNewValues</a></h2>
  1408. <p>Save state of new values to be later restored by <a href="#RestoreNewValues">RestoreNewValues</a>.</p>
  1409. <blockquote><table class='norm'>
  1410. <tr><td><b>Prototype</b></td><td>SaveNewValues($)</td></tr>
  1411. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1412. </td></tr>
  1413. <tr><td valign=top><b>Returns</b></td><td>Count of the number of times this routine has
  1414. been called (N) since the last time the new values were reset.</td></tr>
  1415. </table></blockquote>
  1416. <p><b>Example:</b></p>
  1417. <blockquote><table class='box'><tr><td><pre>
  1418. $exifTool-&gt;<b>SaveNewValues</b>(); <span class=com># save state of new values</span>
  1419. $exifTool-&gt;<a href="#SetNewValue">SetNewValue</a>(ISO =&gt; 100); <span class=com># set new value for ISO</span>
  1420. $exifTool-&gt;<a href="#WriteInfo">WriteInfo</a>($src, $dst1); <span class=com># write ISO plus any previous new values</span>
  1421. $exifTool-&gt;<b>RestoreNewValues</b>(); <span class=com># restore previous new values</span>
  1422. $exifTool-&gt;<a href="#WriteInfo">WriteInfo</a>($src, $dst2); <span class=com># write previous new values only</span>
  1423. </pre></td></tr></table></blockquote>
  1424. <hr><h2><a name="RestoreNewValues">RestoreNewValues</a></h2>
  1425. <p>Restore new values to the settings that existed when
  1426. <a href="#SaveNewValues">SaveNewValues</a> was last called. May be called
  1427. repeatedly after a single call to <a href="#SaveNewValues">SaveNewValues</a>.
  1428. See <a href="#SaveNewValues">SaveNewValues</a> above for an example.</p>
  1429. <blockquote><table class='norm'>
  1430. <tr><td><b>Prototype</b></td><td>RestoreNewValues($)</td></tr>
  1431. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1432. </td></tr>
  1433. </table></blockquote>
  1434. <hr><h2><a name="SetFileModifyDate">SetFileModifyDate</a></h2>
  1435. <p>Write the filesystem modification or creation time from the new value of the
  1436. FileModifyDate or FileCreateDate tag.</p>
  1437. <blockquote><table class='norm'>
  1438. <tr><td><b>Prototype</b></td><td>SetFileModifyDate($$;$$)</td></tr>
  1439. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1440. <br><b>1)</b> File name
  1441. <br><b>2)</b> [<i>optional</i>] Base time if applying shift (in days before $^T)
  1442. <br><b>3)</b> [<i>optional</i>] Tag to write: 'FileModifyDate' (default), or 'FileCreateDate'
  1443. </td></tr>
  1444. <tr><td valign=top><b>Returns</b></td><td>1 if the time was changed, 0 if nothing was
  1445. done, or -1 if there was an error setting the time.
  1446. </td></tr>
  1447. </table></blockquote>
  1448. <p><b>Example:</b></p>
  1449. <blockquote><table class='box'><tr><td><pre>
  1450. $exifTool-&gt;<a href="#SetNewValue">SetNewValue</a>(FileModifyDate =&gt; '2000:01:02 03:04:05', Protected => 1);
  1451. my $result = $exifTool-&gt;<b>SetFileModifyDate</b>($file);
  1452. </pre></td></tr></table></blockquote>
  1453. <p><b>Notes:</b></p>
  1454. <p>Equivalent to, but more efficient than calling <a href="#WriteInfo">WriteInfo</a>
  1455. when only the FileModifyDate or FileCreateDate tag has been set. If a timezone is not
  1456. specified, local time is assumed. When shifting, the time of the original
  1457. file is used unless the optional base time is specified.</p>
  1458. <p>The ability to write FileCreateDate is currently restricted to Windows systems only.</p>
  1459. <hr><h2><a name="SetFileName">SetFileName</a></h2>
  1460. <p>Set the file name and directory, or create a hard link to the file. If not
  1461. specified, the new file name is derived from the new values of the FileName and
  1462. Directory tags, or from the HardLink tag if creating a link. If the FileName
  1463. tag contains a '<code>/</code>', then the file is renamed into a new directory.
  1464. If FileName ends with '<code>/</code>', then it is taken as a directory name and
  1465. the file is moved into the new directory. The new value for the Directory tag
  1466. takes precedence over any directory specified in FileName.</p>
  1467. <blockquote><table class='norm'>
  1468. <tr><td><b>Prototype</b></td><td>SetFileName($$;$$)</td></tr>
  1469. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1470. <br><b>1)</b> Current file name
  1471. <br><b>2)</b> [<i>optional</i>] New file name
  1472. <br><b>3)</b> [<i>optional</i>] 'Link' to create a hard link instead of renaming the file,
  1473. or 'Test' to test renaming feature by printing the old and new names instead of
  1474. changing anything.
  1475. </td></tr>
  1476. <tr><td valign=top><b>Returns</b></td><td>1 if the file name or directory was changed,
  1477. 0 if nothing was done, or -1 if there was an error renaming the file.
  1478. </td></tr>
  1479. </table></blockquote>
  1480. <p><b>Examples:</b></p>
  1481. <blockquote><table class='box'><tr><td><pre>
  1482. my $result = $exifTool-&gt;<b>SetFileName</b>($file);
  1483. </pre></td></tr></table></blockquote>
  1484. <blockquote><table class='box'><tr><td><pre>
  1485. my $result = $exifTool-&gt;<b>SetFileName</b>($file, $newName);
  1486. </pre></td></tr></table></blockquote>
  1487. <p><b>Notes:</b></p>
  1488. <p>Will not overwrite existing files. New directories are created as
  1489. necessary.</p>
  1490. <hr><h2><a name="SetNewGroups">SetNewGroups</a></h2>
  1491. <p>Set the order of the preferred groups when adding new information. In
  1492. subsequent calls to <a href="#SetNewValue">SetNewValue</a>, new information
  1493. will be created in the first valid group of this list. This has an impact
  1494. only if the group is not specified when calling
  1495. <a href="#SetNewValue">SetNewValue</a>, and if the tag name exists in more
  1496. than one group. The default order is EXIF, IPTC then XMP. Any family 0
  1497. group name may be used. Case is not significant.</p>
  1498. <blockquote><table class='norm'>
  1499. <tr><td><b>Prototype</b></td><td>SetNewGroups($;@)</td></tr>
  1500. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1501. <br><b>1-N)</b> Groups in order of priority. If no groups are specified, the
  1502. priorities are reset to the defaults.
  1503. </td></tr>
  1504. </table></blockquote>
  1505. <p><b>Example:</b></p>
  1506. <blockquote><table class='box'><tr><td><pre>
  1507. $exifTool-&gt;<b>SetNewGroups</b>('XMP','EXIF','IPTC');
  1508. </pre></td></tr></table></blockquote>
  1509. <hr><h2><a name="GetNewGroups">GetNewGroups</a></h2>
  1510. <p>Get current group priority list.</p>
  1511. <blockquote><table class='norm'>
  1512. <tr><td><b>Prototype</b></td><td>GetNewGroups($)</td></tr>
  1513. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1514. </td></tr>
  1515. <tr><td valign=top><b>Returns</b></td><td>List of group names in order of write
  1516. priority. Highest priority first.
  1517. </td></tr>
  1518. </table></blockquote>
  1519. <p><b>Example:</b></p>
  1520. <blockquote><table class='box'><tr><td><pre>
  1521. @groups = $exifTool-&gt;<b>GetNewGroups</b>();
  1522. </pre></td></tr></table></blockquote>
  1523. <hr><h2><a name="GetTagID">GetTagID</a></h2>
  1524. <p>Get the ID for the specified tag. The ID is the IFD tag number in EXIF
  1525. information, the property name in XMP information, or the data offset in a
  1526. binary data block. For some tags, such as Composite tags where there is no ID,
  1527. an empty string is returned. In list context, also returns a language code for
  1528. the tag if available and different from the default language (eg. with
  1529. alternate language entries for XMP "lang-alt" tags).</p>
  1530. <blockquote><table class='norm'>
  1531. <tr><td><b>Prototype</b></td><td>GetTagID($$)</td></tr>
  1532. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1533. <br><b>1)</b> Tag key
  1534. </td></tr>
  1535. <tr><td valign=top><b>Returns</b></td><td>In scalar context, returns the tag ID or '' if
  1536. there is no ID for this tag.<br>In list context, returns the tag ID (or '') and the
  1537. language code (or undef).</td></tr>
  1538. </table></blockquote>
  1539. <p><b>Examples:</b></p>
  1540. <blockquote><table class='box'><tr><td><pre>
  1541. my $id = $exifTool-&gt;<b>GetTagID</b>($tag);
  1542. </pre></td></tr></table></blockquote>
  1543. <blockquote><table class='box'><tr><td><pre>
  1544. my ($id, $lang) = $exifTool-&gt;<b>GetTagID</b>($tag);
  1545. </pre></td></tr></table></blockquote>
  1546. <hr><h2><a name="GetDescription">GetDescription</a></h2>
  1547. <p>Get description for specified tag. This function will always return a defined
  1548. value. In the case where the description doesn't exist, one is generated from
  1549. the tag name.</p>
  1550. <blockquote><table class='norm'>
  1551. <tr><td><b>Prototype</b></td><td>GetDescription($$)</td></tr>
  1552. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1553. <br><b>1)</b> Tag key
  1554. </td></tr>
  1555. <tr><td valign=top><b>Returns</b></td><td>Tag description</td></tr>
  1556. </table></blockquote>
  1557. <hr><h2><a name="GetGroup">GetGroup</a></h2>
  1558. <p>Get group name(s) for a specified tag.</p>
  1559. <blockquote><table class='norm'>
  1560. <tr><td><b>Prototype</b></td><td>GetGroup($$;$)</td></tr>
  1561. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1562. <br><b>1)</b> Tag key
  1563. <br><b>2)</b> [<i>optional</i>] Group family number, or string of numbers
  1564. separated by colons
  1565. </td></tr>
  1566. <tr><td valign=top><b>Returns</b></td><td>Group name (or '' if tag has no
  1567. group). If no group family is specified, returns the name of group in family 0
  1568. when called in scalar context, or the names of groups for all families in list
  1569. context. Returns a string of group names separated by colons if the input group
  1570. family contains a colon. The string is simplified to remove a leading 'Main:'
  1571. and adjacent identical group names unless the family string begins with a colon.
  1572. </td></tr>
  1573. </table></blockquote>
  1574. <p>The following families of groups are available:</p>
  1575. <blockquote><table class='norm'>
  1576. <tr><th>Family</th><th>Description</th><th>Examples</th></tr>
  1577. <tr><td align=center>0</td><td>Information Type</td> <td>EXIF, XMP, IPTC</td></tr>
  1578. <tr><td align=center>1</td><td>Specific Location</td><td>IFD0, XMP-dc</td></tr>
  1579. <tr><td align=center>2</td><td>Category</td> <td>Author, Time</td></tr>
  1580. <tr><td align=center>3</td><td>Document Number</td> <td>Main, Doc1, Doc3-2</td></tr>
  1581. <tr><td align=center>4</td><td>Instance Number</td> <td>Copy1, Copy2, Copy3...</td></tr>
  1582. </table></blockquote>
  1583. <p>Families 0 and 1 are based on the file structure, and are similar except that
  1584. family 1 is more specific and sub-divides some groups to give more detail about
  1585. the specific location where the information was found. For example, the EXIF
  1586. group is split up based on the specific IFD (Image File Directory), the
  1587. MakerNotes group is divided into groups for each manufacturer, and the XMP group
  1588. is separated based on the XMP namespace prefix. Note that only common XMP
  1589. namespaces are listed in the <a href="#GetAllGroups">GetAllGroups</a>
  1590. documentation, but additional namespaces may be present in some XMP data. Also
  1591. note that the '<code>XMP-xmp</code>...' group names may appear in the older form
  1592. '<code>XMP-xap</code>...' since these names evolved as the XMP standard was
  1593. developed. The ICC_Profile group is broken down to give information about the
  1594. specific ICC_Profile tag from which multiple values were extracted. As well,
  1595. information extracted from the ICC_Profile header is separated into the
  1596. ICC-header group.</p>
  1597. <p>Family 2 classifies information based on the logical category to which the
  1598. information refers.</p>
  1599. <p>Family 3 gives the document number for tags extracted from embedded documents,
  1600. or 'Main' for tags from the main document. (See the
  1601. <a href="#Embedded">ExtractEmbedded</a> option for extracting tags from embedded
  1602. documents.) Nested sub-documents (if they exist) are indicated by numbers
  1603. separated with dashes in the group name, to an arbitrary depth. (eg.
  1604. '<code>Doc2-3-1</code>' is the 1<sup>st</sup> sub-sub-document of the
  1605. 3<sup>rd</sup> sub-document of the 2<sup>nd</sup> embedded document of the main
  1606. file.)</p>
  1607. <p>Family 4 provides a method for differentiating tags when multiple tags exist
  1608. with the same name in the same location. The primary instance of a tag (the tag
  1609. extracted when the Duplicates option is disabled and no group is specified) has
  1610. no family 4 group name, but additional instances have have family 4 group names
  1611. of '<code>Copy1</code>', '<code>Copy2</code>', '<code>Copy3</code>', etc.</p>
  1612. <p>See <a href="#GetAllGroups">GetAllGroups</a> for lists of group names.</p>
  1613. <p><b>Examples:</b></p>
  1614. <blockquote><table class='box'><tr><td><pre>
  1615. <span class=com># return family 0 group name (eg. 'EXIF')</span>
  1616. $group = $exifTool-&gt;<b>GetGroup</b>($tag, 0);
  1617. </pre></td></tr></table></blockquote>
  1618. <blockquote><table class='box'><tr><td><pre>
  1619. <span class=com># return all groups (eg. qw{EXIF IFD0 Author Main})</span>
  1620. @groups = $exifTool-&gt;<b>GetGroup</b>($tag);
  1621. </pre></td></tr></table></blockquote>
  1622. <blockquote><table class='box'><tr><td><pre>
  1623. <span class=com># return groups as a string (eg. 'Main:IFD0:Author')</span>
  1624. $group = $exifTool-&gt;<b>GetGroup</b>($tag, ':3:1:2');
  1625. </pre></td></tr></table></blockquote>
  1626. <blockquote><table class='box'><tr><td><pre>
  1627. <span class=com># return groups as a simplified string (eg. 'IFD0:Author')</span>
  1628. $group = $exifTool-&gt;<b>GetGroup</b>($tag, '3:1:2');
  1629. </pre></td></tr></table></blockquote>
  1630. <hr><h2><a name="GetGroups">GetGroups</a></h2>
  1631. <p>Get list of group names for all tags in specified information hash.</p>
  1632. <blockquote><table class='norm'>
  1633. <tr><td><b>Prototype</b></td><td>GetGroups($;$$)</td></tr>
  1634. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1635. <br><b>1)</b> [<i>optional</i>] Information hash reference (default is all extracted info)
  1636. <br><b>2)</b> [<i>optional</i>] Group family number (default 0)
  1637. </td></tr>
  1638. <tr><td valign=top><b>Returns</b></td><td>
  1639. List of group names in alphabetical order.
  1640. If information hash is not specified, the group names are returned for
  1641. all extracted information. See <a href="#GetAllGroups">GetAllGroups</a> for
  1642. a list of groups in each family.
  1643. </td></tr>
  1644. </table></blockquote>
  1645. <p><b>Examples:</b></p>
  1646. <blockquote><table class='box'><tr><td><pre>
  1647. my @groups = $exifTool-&gt;<b>GetGroups</b>($info, $family);
  1648. </pre></td></tr></table></blockquote>
  1649. <blockquote>Example of one way to print information organized by group
  1650. <table class='box'><tr><td><pre>
  1651. my $exifTool = <a href="#new">new</a> Image::ExifTool;
  1652. $exifTool-&gt;<a href="#ExtractInfo">ExtractInfo</a>('t/images/ExifTool.jpg');
  1653. my $family = 1;
  1654. my @groups = $exifTool-&gt;<b>GetGroups</b>($family);
  1655. my $group;
  1656. foreach $group (@groups) {
  1657. print "---- $group ----\n";
  1658. my $info = $exifTool-&gt;<a href="#GetInfo">GetInfo</a>({"Group$family" =&gt; $group});
  1659. foreach ($exifTool-&gt;<a href="#GetTagList">GetTagList</a>($info)) {
  1660. print "$_ : $$info{$_}\n";
  1661. }
  1662. }
  1663. </pre></td></tr></table></blockquote>
  1664. <hr><h2><a name="BuildCompositeTags">BuildCompositeTags</a></h2>
  1665. <p>Builds composite tags from required tags. The composite tags are convenience
  1666. tags which are derived from the values of other tags. This routine is called
  1667. automatically by <a href="#ImageInfo">ImageInfo</a> if the Composite option is set.</p>
  1668. <blockquote><table class='norm'>
  1669. <tr><td><b>Prototype</b></td><td>BuildCompositeTags($)</td></tr>
  1670. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> ExifTool object reference
  1671. </td></tr>
  1672. <tr><td valign=top><b>Returns</b></td><td>(none)</td></tr>
  1673. </table></blockquote>
  1674. <p><b>Notes:</b></p>
  1675. <ol>
  1676. <li>Tag values are calculated in alphabetical order unless a tag Require's
  1677. or Desire's another composite tag, in which case the calculation is
  1678. deferred until after the other tag is calculated.</li>
  1679. <li>Composite tags may need to read data from the image for their value to be
  1680. determined, and for these <a href="#BuildCompositeTags">BuildCompositeTags</a>
  1681. must be called while the image is available. This is only a problem if
  1682. <a href="#ImageInfo">ImageInfo</a> is called with a filename (as opposed to a
  1683. file reference or scalar reference) since in this case the file is closed before
  1684. <a href="#ImageInfo">ImageInfo</a> returns. Here the Composite option may be
  1685. used so that <a href="#BuildCompositeTags">BuildCompositeTags</a> is called from
  1686. within <a href="#ImageInfo">ImageInfo</a>, before the file is closed.</li>
  1687. </ol>
  1688. <hr><table bgcolor='#ffaaaa' width='100%' cellpadding=8><tr><td><center><b>
  1689. The following functions access only static data and are not called with an
  1690. ExifTool object
  1691. </b></center></td></tr></table>
  1692. <p>The names of all the following functions, plus
  1693. <a href="#ImageInfo">ImageInfo</a>, may be imported into the current namespace
  1694. with the "Public" tag. When this is done, the functions can be accessed without
  1695. the need to prefix the function name with "<code>Image::ExifTool::</code>". For
  1696. example:</p>
  1697. <blockquote><table class='box'><tr><td><pre>
  1698. use Image::ExifTool ':Public';
  1699. $tagName = <a href="#GetTagName">GetTagName</a>($tag);
  1700. </pre></td></tr></table></blockquote>
  1701. <hr><h2><a name="GetTagName">GetTagName</a></h2>
  1702. <p>Get name of tag from tag identifier. This is a convenience function that
  1703. strips the embedded instance number, if it exists, from the tag key.</p>
  1704. <blockquote><table class='norm'>
  1705. <tr><td><b>Prototype</b></td><td>GetTagName($)</td></tr>
  1706. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> Tag key
  1707. </td></tr>
  1708. <tr><td valign=top><b>Returns</b></td><td>Tag name</td></tr>
  1709. </table></blockquote>
  1710. <p><b>Example:</b></p>
  1711. <blockquote><table class='box'><tr><td><pre>
  1712. $tagName = Image::ExifTool::<b>GetTagName</b>($tag);
  1713. </pre></td></tr></table></blockquote>
  1714. <hr><h2><a name="GetShortcuts">GetShortcuts</a></h2>
  1715. <p>Get list of tag shortcut names.</p>
  1716. <blockquote><table class='norm'>
  1717. <tr><td><b>Prototype</b></td><td>GetShortcuts()</td></tr>
  1718. <tr><td valign=top><b>Inputs</b></td><td>(none)
  1719. </td></tr>
  1720. <tr><td valign=top><b>Returns</b></td><td>List of shortcuts</td></tr>
  1721. </table></blockquote>
  1722. <hr><h2><a name="GetAllTags">GetAllTags</a></h2>
  1723. <p>Get list of all available tag names.</p>
  1724. <blockquote><table class='norm'>
  1725. <tr><td><b>Prototype</b></td><td>GetAllTags(;$)</td></tr>
  1726. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> [<i>optional</i>] Group name,
  1727. or string of group names separated by colons
  1728. </td></tr>
  1729. <tr><td valign=top><b>Returns</b></td><td>A list of all available tags in alphabetical
  1730. order, or all tags in a specified group or intersection of groups. The
  1731. group name is case insensitive, and any group in families 0-2 may be used
  1732. except for EXIF family 1 groups (ie. the specific IFD).
  1733. </td></tr>
  1734. </table></blockquote>
  1735. <hr><h2><a name="GetWritableTags">GetWritableTags</a></h2>
  1736. <p>Get list of all writable tag names.</p>
  1737. <blockquote><table class='norm'>
  1738. <tr><td><b>Prototype</b></td><td>GetWritableTags(;$)</td></tr>
  1739. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> [<i>optional</i>] Group name,
  1740. or string of group names separated by colons
  1741. </td></tr>
  1742. <tr><td valign=top><b>Returns</b></td><td>A list of all writable tags in alphabetical
  1743. order. These are the tags for which values may be set through
  1744. <a href="#SetNewValue">SetNewValue</a>. If a group name is given, returns
  1745. only writable tags in specified group(s). The group name is case insensitive,
  1746. and any group in families 0-2 may be used except for EXIF family 1 groups (ie.
  1747. the specific IFD).
  1748. </td></tr>
  1749. </table></blockquote>
  1750. <hr><h2><a name="GetAllGroups">GetAllGroups</a></h2>
  1751. <p>Get list of all group names in specified family.</p>
  1752. <blockquote><table class='norm'>
  1753. <tr><td><b>Prototype</b></td><td>GetAllGroups($)</td></tr>
  1754. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> Group family number (0-4)
  1755. </td></tr>
  1756. <tr><td valign=top><b>Returns</b></td>
  1757. <td>A list of all groups in the specified family in alphabetical order</td></tr>
  1758. </table></blockquote>
  1759. <p>Here is a complete list of groups for each family:</p>
  1760. <blockquote><table class='norm'>
  1761. <tr><th>Family</th><th>Group Names</th></tr>
  1762. <tr><td><b>0 (Information&nbsp;Type)</b></td>
  1763. <td>AFCP, AIFF, APE, APP0, APP1, APP11, APP12, APP13, APP14, APP15, APP4, APP5,
  1764. APP6, APP8, ASF, Audible, CanonVRD, Composite, DICOM, DNG, DV, DjVu, Ducky,
  1765. EXE, EXIF, ExifTool, FLAC, FLIR, File, Flash, FlashPix, Font, FotoStation,
  1766. GIF, GIMP, GeoTiff, H264, HTML, ICC_Profile, ID3, IPTC, ITC, JFIF, JPEG,
  1767. Jpeg2000, LNK, Leaf, Lytro, M2TS, MIE, MIFF, MNG, MOI, MPC, MPEG, MPF, MXF,
  1768. MakerNotes, Matroska, Meta, Ogg, OpenEXR, PDF, PICT, PLIST, PNG, PSP, Palm,
  1769. PanasonicRaw, PhotoCD, PhotoMechanic, Photoshop, PostScript, PrintIM,
  1770. QuickTime, RAF, RIFF, RSRC, RTF, Radiance, Rawzor, Real, SVG, SigmaRaw,
  1771. Stim, Theora, Torrent, VCard, Vorbis, XML, XMP, ZIP
  1772. </td></tr>
  1773. <tr><td><b>1&nbsp;(Specific&nbsp;Location)</b></td>
  1774. <td>AC3, AFCP, AIFF, APE, ASF, AVI1, Adobe, AdobeCM, AdobeDNG, Apple, Audible,
  1775. CIFF, Canon, CanonCustom, CanonRaw, CanonVRD, Casio, Chapter#, Composite,
  1776. DICOM, DNG, DV, DjVu, DjVu-Meta, Ducky, EPPIM, EXE, EXIF, ExifIFD, ExifTool,
  1777. FLAC, FLIR, File, Flash, FlashPix, Font, FotoStation, FujiFilm, FujiIFD, GE,
  1778. GIF, GIMP, GPS, GeoTiff, GlobParamIFD, GraphConv, H264, HP, HTC, HTML,
  1779. HTML-dc, HTML-ncc, HTML-office, HTML-prod, HTML-vw96, HTTP-equiv, ICC-chrm,
  1780. ICC-clrt, ICC-header, ICC-meas, ICC-meta, ICC-view, ICC_Profile,
  1781. ICC_Profile#, ID3, ID3v1, ID3v1_Enh, ID3v2_2, ID3v2_3, ID3v2_4, IFD0, IFD1,
  1782. IPTC, IPTC#, ITC, InteropIFD, JFIF, JPEG, JPEG-HDR, JVC, Jpeg2000, KDC_IFD,
  1783. Kodak, KodakBordersIFD, KodakEffectsIFD, KodakIFD, KyoceraRaw, LNK, Leaf,
  1784. LeafSubIFD, Leica, Lytro, M2TS, MAC, MIE-Audio, MIE-Camera, MIE-Canon,
  1785. MIE-Doc, MIE-Extender, MIE-Flash, MIE-GPS, MIE-Geo, MIE-Image, MIE-Lens,
  1786. MIE-Main, MIE-MakerNotes, MIE-Meta, MIE-Orient, MIE-Preview, MIE-Thumbnail,
  1787. MIE-UTM, MIE-Unknown, MIE-Video, MIFF, MNG, MOBI, MOI, MPC, MPEG, MPF0,
  1788. MPImage, MXF, MakerNotes, MakerUnknown, Matroska, MediaJukebox, MetaIFD,
  1789. Microsoft, Minolta, MinoltaRaw, Motorola, NITF, Nikon, NikonCapture,
  1790. NikonCustom, NikonScan, Nintendo, Ocad, Ogg, Olympus, OpenEXR, PDF, PICT,
  1791. PNG, PNG-pHYs, PSP, Palm, Panasonic, PanasonicRaw, Pentax, PhaseOne,
  1792. PhotoCD, PhotoMechanic, Photoshop, PictureInfo, PostScript, PreviewIFD,
  1793. PrintIM, ProfileIFD, Qualcomm, QuickTime, RAF, RAF2, RIFF, RMETA, RSRC, RTF,
  1794. Radiance, Rawzor, Real, Real-CONT, Real-MDPR, Real-PROP, Real-RA3, Real-RA4,
  1795. Real-RA5, Real-RJMD, Reconyx, Ricoh, SPIFF, SR2, SR2DataIFD, SR2SubIFD,
  1796. SRF#, SVG, Samsung, Sanyo, Scalado, Sigma, SigmaRaw, Sony, SonyIDC, Stim,
  1797. SubIFD, System, Theora, Torrent, Track#, VCalendar, VCard, Version0, Vorbis,
  1798. XML, XMP, XMP-DICOM, XMP-GPano, XMP-MP, XMP-MP1, XMP-PixelLive, XMP-aas,
  1799. XMP-acdsee, XMP-album, XMP-apple-fi, XMP-aux, XMP-cc, XMP-cell, XMP-crs,
  1800. XMP-dc, XMP-dex, XMP-digiKam, XMP-dwc, XMP-exif, XMP-exifEX,
  1801. XMP-expressionmedia, XMP-extensis, XMP-fpv, XMP-getty, XMP-ics,
  1802. XMP-iptcCore, XMP-iptcExt, XMP-lr, XMP-mediapro, XMP-microsoft,
  1803. XMP-mwg-coll, XMP-mwg-kw, XMP-mwg-rs, XMP-pdf, XMP-pdfx, XMP-photomech,
  1804. XMP-photoshop, XMP-plus, XMP-prism, XMP-prl, XMP-pur, XMP-rdf, XMP-swf,
  1805. XMP-tiff, XMP-x, XMP-xmp, XMP-xmpBJ, XMP-xmpDM, XMP-xmpMM, XMP-xmpNote,
  1806. XMP-xmpPLUS, XMP-xmpRights, XMP-xmpTPg, ZIP
  1807. </td></tr>
  1808. <tr><td><b>2&nbsp;(Category)</b></td>
  1809. <td>Audio, Author, Camera, Document, ExifTool, Image, Location, Other,
  1810. Preview, Printing, Time, Unknown, Video
  1811. </td></tr>
  1812. <tr><td><b>3&nbsp;(Document&nbsp;Number)</b></td>
  1813. <td>Doc#, Main
  1814. </td></tr>
  1815. <tr><td><b>4&nbsp;(Instance&nbsp;Number)</b></td>
  1816. <td>Copy#
  1817. </td></tr>
  1818. </table></blockquote>
  1819. <p><b>Example:</b></p>
  1820. <blockquote><table class='box'><tr><td><pre>
  1821. @groupList = Image::ExifTool::<b>GetAllGroups</b>($family);
  1822. </pre></td></tr></table></blockquote>
  1823. <hr><h2><a name="GetDeleteGroups">GetDeleteGroups</a></h2>
  1824. <p>Get list of all deletable group names.</p>
  1825. <blockquote><table class='norm'>
  1826. <tr><td><b>Prototype</b></td><td>GetDelGroups()</td></tr>
  1827. <tr><td valign=top><b>Inputs</b></td>
  1828. <td>None
  1829. </td></tr>
  1830. <tr><td valign=top><b>Returns</b></td><td>A list of deletable group names in
  1831. alphabetical order.
  1832. </td></tr>
  1833. </table></blockquote>
  1834. <p>Below is a current list of deletable group names. All names in this list
  1835. are either family 0 or family 1 group names, with the exception of
  1836. '<code>Trailer</code>' which allows all trailers in JPEG and TIFF-format images
  1837. to be deleted at once, including unknown trailers. To schedule a group for
  1838. deletion, call <a href="#SetNewValue">SetNewValue</a> with an undefined value
  1839. and a tag name like '<code>Trailer:*</code>'.</p>
  1840. <blockquote>AFCP, APP0, APP1, APP10, APP11, APP12, APP13, APP14, APP15, APP2, APP3,
  1841. APP4, APP5, APP6, APP7, APP8, APP9, Adobe, Audio, Author, CIFF, Camera,
  1842. CanonVRD, Copyright, Document, Ducky, EXIF, ExifIFD, ExifTool, File,
  1843. FlashPix, FotoStation, GPS, GlobParamIFD, ICC_Profile, IFD0, IFD1, IPTC,
  1844. Image, InteropIFD, JFIF, Jpeg2000, Location, MIE, MPF, MakerNotes, Meta,
  1845. MetaIFD, NikonCapture, Other, PDF, PDF-update, PNG, PNG-pHYs, PhotoMechanic,
  1846. Photoshop, PrintIM, Printing, RMETA, RSRC, SubIFD, Time, Trailer, Video,
  1847. XML, XML-*, XMP, XMP-*</blockquote>
  1848. <p>Note that the JPEG "APP" groups are special, and are used only to delete
  1849. application segments which are not associated with another deletable group. For
  1850. example, deleting '<code>APP14:*</code>' will delete other APP14 segments, but
  1851. not the APP14 "Adobe" segment. Also note that deleting a family 0 or 1 group
  1852. will delete the entire corresponding block of metadata, but deleting a family 2
  1853. group (eg. Audio, Author, Camera, etc.) deletes the individual tags belonging
  1854. to that category.</p>
  1855. <p><b>Example:</b></p>
  1856. <blockquote><table class='box'><tr><td><pre>
  1857. my @delGroups = Image::ExifTool::<b>GetDelGroups</b>();
  1858. </pre></td></tr></table></blockquote>
  1859. <hr><h2><a name="GetFileType">GetFileType</a></h2>
  1860. <p>Get type of file given file name.</p>
  1861. <blockquote><table class='norm'>
  1862. <tr><td><b>Prototype</b></td><td>GetFileType(;$$)</td></tr>
  1863. <tr><td valign=top><b>Inputs</b></td>
  1864. <td><b>0)</b> [<i>optional</i>] File name or extension
  1865. <br><b>1)</b> [<i>optional</i>] Flag to return a description instead of a type.
  1866. Set to 0 to return type for recognized but unsupported files (otherwise the
  1867. return value for unsupported files is undef).
  1868. </td></tr>
  1869. <tr><td valign=top><b>Returns</b></td><td>A string, based on the file extension, which
  1870. indicates the basic format of the file. Note that some files may be based on
  1871. other formats (like many RAW image formats are based on TIFF). In array
  1872. context, may return more than one file type if the file may be based on
  1873. different formats. Returns undef if files with this extension are not yet
  1874. supported by ExifTool. Returns a list of extensions for all supported file
  1875. types if no input extension is specified (or all recognized file types if the
  1876. description flag is set to 0). Returns a more detailed description of the
  1877. specific file format when the description flag is set.</td></tr>
  1878. </table></blockquote>
  1879. <p><b>Examples:</b></p>
  1880. <blockquote><table class='box'><tr><td><pre>
  1881. my $type = Image::ExifTool::<b>GetFileType</b>($filename);
  1882. my $desc = Image::ExifTool::<b>GetFileType</b>($filename, 1);
  1883. </pre></td></tr></table></blockquote>
  1884. <hr><h2><a name="CanWrite">CanWrite</a></h2>
  1885. <p>Can the specified file be written?</p>
  1886. <blockquote><table class='norm'>
  1887. <tr><td><b>Prototype</b></td><td>CanWrite($)</td></tr>
  1888. <tr><td valign=top><b>Inputs</b></td>
  1889. <td><b>0)</b> File name or extension</td></tr>
  1890. <tr><td valign=top><b>Returns</b></td><td>True if ExifTool supports writing files of
  1891. this type (based on the file extension).</td></tr>
  1892. </table></blockquote>
  1893. <p><b>Example:</b></p>
  1894. <blockquote><table class='box'><tr><td><pre>
  1895. my $writable = Image::ExifTool::<b>CanWrite</b>($filename);
  1896. </pre></td></tr></table></blockquote>
  1897. <hr><h2><a name="CanCreate">CanCreate</a></h2>
  1898. <p>Can the specified file be created?</p>
  1899. <blockquote><table class='norm'>
  1900. <tr><td><b>Prototype</b></td><td>CanCreate($)</td></tr>
  1901. <tr><td valign=top><b>Inputs</b></td>
  1902. <td><b>0)</b> File name or extension</td></tr>
  1903. <tr><td valign=top><b>Returns</b></td><td>True if ExifTool can create files with this
  1904. extension from scratch.<br>Currently, this can only be done with XMP, MIE, ICC,
  1905. VRD, DR4, EXV and EXIF files.</td></tr>
  1906. </table></blockquote>
  1907. <p><b>Example:</b></p>
  1908. <blockquote><table class='box'><tr><td><pre>
  1909. my $creatable = Image::ExifTool::<b>CanCreate</b>($filename);
  1910. </pre></td></tr></table></blockquote>
  1911. <hr><h2><a name="AddUserDefinedTags">AddUserDefinedTags</a></h2>
  1912. <p>Add user-defined tags to an existing tag table at run time. This differs from
  1913. the usual technique of creating user-defined tags via the
  1914. %Image::ExifTool::UserDefined hash (see the
  1915. <a href="config.html">sample config file</a>), because it allows tags to be added
  1916. after the tag table has been initialized.</p>
  1917. <blockquote><table class='norm'>
  1918. <tr><td><b>Prototype</b></td><td>AddUserDefinedTags($%)</td></tr>
  1919. <tr><td valign=top><b>Inputs</b></td><td><b>0)</b> Destination tag table name
  1920. <br><b>1-N)</b> Pairs of tag ID / tag information hash references for the new tags
  1921. </td></tr>
  1922. <tr><td valign=top><b>Returns</b></td><td>The number of tags added</td></tr>
  1923. </table></blockquote>
  1924. <p><b>Example:</b></p>
  1925. <blockquote><table class='box'><tr><td><pre>
  1926. use Image::ExifTool ':Public';
  1927. my %tags = (
  1928. TestTagID1 => { Name => 'TestTagName1' },
  1929. TestTagID2 => { Name => 'TestTagName2' },
  1930. );
  1931. my $num = <b>AddUserDefinedTags</b>('Image::ExifTool::PDF::Info', %tags);
  1932. </pre></td></tr></table></blockquote>
  1933. <p><b>Notes:</b></p>
  1934. <p>Pre-existing tags with the same ID will be replaced in the destination table.
  1935. See lib/Image/ExifTool/README in the full distribution for full details on the
  1936. elements of the tag information hash.</p>
  1937. <hr>
  1938. <p class='lf'><a href="index.html">&lt;-- Back to ExifTool home page</a></p>
  1939. </body>
  1940. </html>