faq.html 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536
  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>ExifTool FAQ</title>
  6. <link rel=stylesheet type='text/css' href='style.css' title='Style'>
  7. <style type="text/css">
  8. <!--
  9. pre { color: #800; margin-left: 2em }
  10. ol.index { margin: 0; padding: 0 0 0 2em }
  11. .U { color: #c84 } /* unused data block */
  12. .prog { padding: 0.5em; border: 1px solid gray; background: #fee }
  13. -->
  14. </style>
  15. </head>
  16. <body>
  17. <div class='index'>
  18. <ol class='index'>
  19. <li><a href="#Q1">Discussion forum</a></li>
  20. <li><a href="#Q2">Determining tag names</a></li>
  21. <li><a href="#Q3">ExifTool doesn't read/write properly</a></li>
  22. <li><a href="#Q4">Aperture and shutter speed</a></li>
  23. <li><a href="#Q5">Date and time formats</a></li>
  24. <li><a href="#Q6">"Can't convert TAG" errors</a></li>
  25. <li><a href="#Q7">Deleting all EXIF from a TIFF</a></li>
  26. <li><a href="#Q8">Writing Make, Model &amp; MakerNotes</a></li>
  27. <li><a href="#Q9">Tag locations when copying</a></li>
  28. <li><a href="#Q10">Coded character sets</a></li>
  29. <li><a href="#Q11">User-defined tags</a></li>
  30. <li><a href="#Q12">Export to database</a></li>
  31. <li><a href="#Q13">Output file size</a></li>
  32. <li><a href="#Q14">GPS coordinate format</a></li>
  33. <li><a href="#Q15">MakerNote errors</a></li>
  34. <li><a href="#Q16">Some files not renamed</a></li>
  35. <li><a href="#Q17">List-type tags</a></li>
  36. <li><a href="#Q18">Windows character encoding</a></li>
  37. <li><a href="#Q19">Formatting tag values</a></li>
  38. <li><a href="#Q20">Write errors (repair corrupted EXIF)</a></li>
  39. <li><a href="#Q21">Newlines in values</a></li>
  40. <li><a href="#Q22">Order of operations</a></li>
  41. <li><a href="#Q23">"0 image files updated"</a></li>
  42. <li><a href="#Q24">Date/time gets reset to today</a></li>
  43. <li><a href="#Q25">Image validation</a></li>
  44. <li><a href="#Q26">Import from database</a></li>
  45. </ol>
  46. </div>
  47. <h1 class='up'>ExifTool FAQ</h1>
  48. <a name="Q1"></a>
  49. <p>1. <b>"Is there a forum for discussing ExifTool issues?"</b></p>
  50. <blockquote>
  51. ExifTool issues can be discussed on the ExifTool forum at
  52. <a href="http://u88.n24.queensu.ca/exiftool/forum/">http://u88.n24.queensu.ca/exiftool/forum/</a>
  53. </blockquote>
  54. <a name="Q2"></a>
  55. <p>2. <b>"How do I determine the tag name for some information?"</b></p>
  56. <blockquote>When you run exiftool, by default it prints descriptions, not tag
  57. names, for the information it extracts. These descriptions are in English
  58. unless the <code>-lang</code> option is used to select another language. Note
  59. that descriptions often contain spaces between words, but tag names never do.
  60. Also, tag names are always English, regardless of the <code>-lang</code>
  61. setting. To print the tag names instead instead of descriptions, use the
  62. <code>-s</code> option when extracting information. eg)
  63. <pre>exiftool -s image.jpg</pre>
  64. Valid characters in tag names are <code>A-Z</code>, <code>a-z</code>,
  65. <code>0-9</code>, <code>_</code> and <code>-</code>. See the
  66. <a href="TagNames/index.html">tag name documentation</a> for a complete list of
  67. available tag names.</blockquote>
  68. <blockquote>Tag names may be optionally prefixed by a family 0 or 1 group name
  69. to specify a particular information type or location. Use the
  70. <code>-g0</code> and <code>-g1</code> (or
  71. <code>-G0</code> and <code>-G1</code>) options when extracting
  72. information to see the corresponding group names.
  73. </blockquote>
  74. <a name="Q3"></a>
  75. <p>3a. <b>"ExifTool reports the wrong value or doesn't extract a tag"</b>,
  76. <br>3b. <b>"ExifTool doesn't write a tag properly"</b>, or
  77. <br>3c. <b>"Other software can't read information written by ExifTool"</b></p>
  78. <blockquote><i>[Also see <a href="#Q23">FAQ number 23</a> for reasons why
  79. ExifTool may not write some tags to certain file types.]</i></blockquote>
  80. <blockquote>First, make sure you are looking at the right information. Use
  81. ExifTool with a command like this to extract all information from the file,
  82. along with the location it was written:
  83. <pre>exiftool -a -G1 -s c:\images\test.jpg</pre>
  84. In this command, <code>-a</code> allows duplicate tags to be extracted,
  85. <code>-G1</code> shows the family 1 group name (ie. the location) of each tag,
  86. and <code>-s</code> shows the tag names instead of their descriptions.
  87. (Substitute the path name of your file in place of
  88. "<code>c:\images\test.jpg</code>".)</blockquote>
  89. <blockquote>When duplicate tags exist, only one is extracted unless the
  90. <code>-a</code> option is used. Beware that options like <code>-EXIF:all</code>
  91. select all EXIF tags from the extracted tags, so EXIF tags hidden by duplicate
  92. tags in other locations will not appear in the output for
  93. <code>-EXIF:all</code>. For example, the command
  94. <pre>exiftool -gps:all image.jpg</pre>
  95. will NOT necessarily extract all GPS tags because some GPS tags may have been
  96. suppressed by same-named tags in other groups. To be sure all GPS tags are
  97. extracted, the <code>-a</code> option must be used:
  98. <pre>exiftool -a -gps:all image.jpg</pre>
  99. If you are having problems with other software reading information written by
  100. ExifTool, if possible try first writing the information from the other software,
  101. then use ExifTool (with the <code>-a</code> and <code>-G1</code> options) to
  102. determine where the information was written. Once you know where it should go,
  103. you can use ExifTool to write to this location. You can read or write
  104. information in a specific location by prefixing the tag name on the command line
  105. with the desired group name. eg.) "<code>-ExifIFD:DateTimeOriginal</code>"
  106. </blockquote>
  107. <blockquote>This problem may also occur if contradictory information exists in
  108. different meta information formats within the same file. For example, often XMP
  109. will be ignored if IPTC exists and the Photoshop:IPTCDigest does not agree with
  110. the IPTC content. The
  111. <a href="http://www.metadataworkinggroup.org/">Metadata Working Group</a>
  112. recommends techniques to keep the EXIF, IPTC and XMP metadata synchronized.
  113. These recommendations are implemented by the ExifTool
  114. <a href="TagNames/MWG.html">MWG tags</a>. For maximum compatibility with the
  115. widest range of applications, it is suggested that these MWG tags be used
  116. whenever possible.</blockquote>
  117. <blockquote>One final note: When writing, the <code>-v2</code> option may be
  118. useful because it provides details about what ExifTool is writing, and where.
  119. </blockquote>
  120. <a name="Q4"></a>
  121. <p>4. <b>"ExifTool reports more than one shutter speed or aperture value, and
  122. they are slightly different"</b></p>
  123. <blockquote>
  124. There are a number of different ways that aperture and shutter speed information
  125. are stored in many images. The standard EXIF values (EXIF:FNumber and
  126. EXIF:ExposureTime) should correspond to the values displayed by your camera,
  127. but these values may have been rounded off. The corresponding EXIF APEX
  128. values (EXIF:ApertureValue and EXIF:ShutterSpeedValue) may be different due
  129. to their own round-off errors. If available, the MakerNotes values may be
  130. the most accurate because they haven't been rounded off to nice even values
  131. for display, so with these you may see odd values like 1/102 instead of
  132. 1/100, etc.
  133. </blockquote>
  134. <a name="Q5"></a>
  135. <p>5. <b>"How do I format date and time information for writing?"</b></p>
  136. <blockquote>All information (including date/time information) is written in the
  137. same format as it is read out. When reading, ExifTool converts all date and
  138. time information to standard EXIF format, so this is also the way it is
  139. specified when writing. The standard EXIF date/time format is
  140. "<code>YYYY:mm:dd HH:MM:SS</code>", and some meta information formats such as
  141. XMP also allow sub-seconds and a timezone to be specified. The timezone format
  142. is "<code>+HH:MM</code>", "<code>-HH:MM</code>" or "<code>Z</code>". For
  143. example:
  144. <pre>exiftool -xmp:dateTimeOriginal="2005:10:23 20:06:34.33-05:00" a.jpg
  145. </pre>
  146. When writing XMP or other information types which allow incomplete date/time
  147. values, the following input formats are also accepted:
  148. <pre>YYYY
  149. YYYY:mm
  150. YYYY:mm:dd
  151. YYYY:mm:dd HH:MM
  152. </pre>
  153. Having said this, ExifTool is very flexible about the actual format of input
  154. date/time values when writing, and will attempt to reformat any values into the
  155. standard format unless the <code>-n</code> option is used. Any separators may
  156. be used (or in fact, none at all). The first 4 consecutive digits found in the
  157. value are interpreted as the year, then next 2 digits are the month, and so on.
  158. <i class=lt>[The year must be 4 digits. Other fields are expected to be 2
  159. digits, but a single digit is allowed if the subsequent character is a
  160. non-digit.]</i> For EXIF date/time values, all 6 date/time fields must exist
  161. ("<code>YYYYmmddHHMMSS</code>"), but XMP date/time values require only the year
  162. ("<code>YYYY</code>"). This feature facilitates useful operations such as
  163. setting date/time tags from a date embedded in the file name. For example, the
  164. command
  165. <pre>exiftool "-alldates&lt;filename" c:\images</pre>
  166. will set the common date/time tags from the file name for all images in the
  167. directory "<code>c:\images</code>". This will work for any file name which
  168. matches the above criteria (eg. "IMG_20110927_103000.jpg").
  169. <i class=lt>[AllDates is a shortcut for 3 tag names: DateTimeOriginal,
  170. CreateDate and ModifyDate. See the <a href="TagNames/Shortcuts.html">Shortcuts
  171. Tags documentation</a> for more information.]</i></blockquote>
  172. <blockquote>The <code>-d</code> option allows full control over the format of
  173. date/time values when reading. However, the effect of the <code>-d</code>
  174. option is not reversible, so date/time values must be written using the format
  175. described above, even when the <code>-d</code> option is used. Note that when
  176. reading, the effect of the <code>-n</code> option on date/time values is only to
  177. disable the <code>-d</code> formatting.</blockquote>
  178. <blockquote><b>Special feature</b>: A value of "<code>now</code>" may be used to
  179. represent the current time when writing any date/time tag. For example:
  180. <pre>exiftool -xmp:dateTimeOriginal=now a.jpg</pre>
  181. <i class=lt>[There is also a <a href="TagNames/Extra.html">Now tag</a> which may
  182. be used for a similar purpose by copying its value to another tag, but copying
  183. tags adds an extra read stage to the processing which is best avoided if
  184. performance is an issue.]</i>
  185. </blockquote>
  186. <a name="Q6"></a>
  187. <p>6. <b>"I get '<code>Can't convert TAG (not in PrintConv)</code>' errors when
  188. writing a tag"</b></p>
  189. <blockquote>
  190. By default, ExifTool applies a print conversion (PrintConv) to extracted
  191. information to make the output more human-readable. Some conversions involve
  192. lookup tables which are documented in the <b>Values</b> column of the
  193. <a href="TagNames/index.html">tag name documentation</a>. For example, the
  194. GPSAltitudeRef tag defines the following conversions:
  195. <pre>0 = Above Sea Level
  196. 1 = Below Sea Level
  197. </pre>
  198. For this tag, a value of '0' is printed as 'Above Sea Level', and '1' is printed
  199. as 'Below Sea Level'. Reading and writing with ExifTool is symmetrical <i>[with
  200. the possible exception of list-type tags -- see <a href="#Q17">FAQ number 17</a>
  201. below]</i>, so a value that is printed as 'Above Sea Level' must also be written in
  202. that form. (In other words, the inverse print conversion is applied when writing
  203. values.) For example, to write GPSAltitudeRef you can type:
  204. <pre>exiftool -gpsaltituderef="Above Sea Level" image.jpg
  205. </pre>
  206. or any unambiguous short form may be used and ExifTool will know what you mean, eg)
  207. <pre>exiftool -gpsaltituderef=above image.jpg
  208. </pre>
  209. Alternatively, the print conversion can be disabled for all tags with the
  210. <code>-n</code> option, or for individual tags by suffixing the tag name with a
  211. '<code>#</code>' character. In either case the printed value of GPSAltitudeRef
  212. will be '0' or '1' when extracting information, and the value is written in the
  213. same way. So following two commands have exactly the same effect as above:
  214. <pre>exiftool -gpsaltituderef=0 -n image.jpg
  215. exiftool -gpsaltituderef#=0 image.jpg
  216. </pre>
  217. Integer values may also be specified in hexadecimal (with a leading '0x'). For
  218. example, the following commands are all equivalent:
  219. <pre>exiftool -flash=1 -n image.jpg
  220. exiftool -flash=0x1 -n image.jpg
  221. exiftool -flash#=1 image.jpg
  222. exiftool -flash#=0x1 image.jpg
  223. exiftool -flash=fired image.jpg
  224. </pre></blockquote><blockquote class=prog>
  225. <b>Programmers</b>: These techniques look like this when calling Image::ExifTool
  226. functions from a Perl script:
  227. <pre>$exifTool->SetNewValue(flash => 1, Type => 'ValueConv');
  228. $exifTool->SetNewValue(flash => 0x1, Type => 'ValueConv');
  229. $exifTool->SetNewValue('flash#' => 1);
  230. $exifTool->SetNewValue('flash#' => 0x1);
  231. $exifTool->SetNewValue(flash => 'fired');
  232. </pre></blockquote>
  233. <a name="Q7"></a>
  234. <p>7. <b>"I can't delete all EXIF information from a TIFF file using
  235. '<code>exiftool -exif:all= img.tif</code>'"</b></p>
  236. <blockquote>This is because of the way a TIFF file is structured. With a JPEG
  237. image, this command removes IFD0 (the main Image File Directory) as well as any
  238. subdirectories, thus removing all EXIF information. But with the TIFF format,
  239. the main image itself is stored in IFD0, so deleting this directory would
  240. destroy the image. The same is true for any TIFF-based RAW file such as DNG,
  241. CR2, NEF, etc. For these types of files, ExifTool just deletes the ExifIFD
  242. subdirectory, so any information stored in other directories is preserved.
  243. </blockquote>
  244. <blockquote>Use "<code>exiftool -a -G1 -s img.tif</code>" to see where the
  245. information is stored. Any tags remaining in other IFD's must be deleted
  246. individually from a TIFF-format file if desired. For convenience, a
  247. <a href="TagNames/Shortcuts.html">shortcut tag</a> is provided to simplify the
  248. deletion of common metadata tags from IFD0 by adding "<code>-CommonIFD0=</code>"
  249. to the command line.
  250. </blockquote>
  251. <a name="Q8"></a>
  252. <p>8a. <b>"All maker note information is lost if I change the Make or Model tag"</b>, or
  253. <br>8b. <b>"I can't copy maker note information to an image"</b>, or
  254. <br>8c. <b>"I can't view a RAW image after changing the model tag"</b></p>
  255. <blockquote>
  256. The Make and Model tags are used by some image utilities (including ExifTool) to
  257. determine the format of the maker note information. Deleting or changing either
  258. of these tags may prevent these utilities from recognizing or properly
  259. interpreting the maker notes (which, for a RAW image, may mean that the image
  260. can no longer be properly rendered). Also beware that the maker notes
  261. information may be damaged if an image is edited when the maker notes are not
  262. properly recognized. So it is a good idea not to edit the Make and Model tags in
  263. the first place.</blockquote>
  264. <blockquote>If you really want to delete the Make and Model information, you
  265. might as well delete the maker notes too. You can do this with either of the
  266. following commands:
  267. <pre>exiftool -make= -model= -makernotes:all= image.jpg
  268. exiftool -make= -model= -makernotes= image.jpg
  269. </pre>
  270. For the same reason, maker notes can not be copied to an image with an
  271. incompatible Make or Model. To do this, the Make and Model tags must also be
  272. copied. eg)
  273. <pre>exiftool -tagsfromfile src.jpg -makernotes -make -model dst.jpg
  274. </pre>
  275. (Note that in this case the "<code>-makernotes:all</code>" syntax does not work
  276. because it attempts to copy the maker note tags individually. Since maker note
  277. tags may not be created individually, they must instead be copied as a block
  278. with "<code>-makernotes</code>".)
  279. </blockquote>
  280. <a name="Q9"></a>
  281. <p>9a. <b>"The information is different when I copy all tags to a new file"</b>, or
  282. <br>9b. <b>"The tag locations change when I use <code>-tagsfromfile</code>
  283. to copy information"</b></p>
  284. <blockquote>
  285. This feature is explained under the <code>-tagsFromFile</code> option in
  286. the <a href="exiftool_pod.html">exiftool application documentation</a>, but the
  287. question is common enough that it is discussed here in more detail.</blockquote>
  288. <blockquote>By default, ExifTool will store information in preferred locations
  289. when either writing new information or copying information between files. This
  290. freedom allows ExifTool to write or copy information to files of different
  291. formats without requiring the user to know details about where the information
  292. is stored.</blockquote>
  293. <blockquote>The preferred general locations for information written to JPEG
  294. images are 1) EXIF, 2) IPTC and 3) XMP. As an example, information extracted
  295. from the maker notes will be preferentially written (on a tag-by-tag basis) in
  296. EXIF format when copying information between two JPEG images. But if a specific
  297. tag doesn't exist in EXIF, then the tag is written to the first valid group in
  298. the order specified above. The advantage of "translating" the information to
  299. EXIF is that it then becomes readable by applications which only support
  300. standard EXIF. The disadvantage is that you don't get an exact copy of the
  301. original information structure.</blockquote>
  302. <blockquote>But ExifTool gives you the ability to customize this behaviour to
  303. write the information to wherever you want. This is done by specifying a group
  304. name for the tag(s) to be copied. This applies even if the group name is
  305. "<code>all</code>", in which case the original family 1 group is preserved. So
  306. to copy all information and preserve the original structure, use this syntax:
  307. <pre>exiftool -tagsfromfile src.jpg -all:all dst.jpg
  308. </pre>
  309. In this command, since no destination tag was specified, the destination is the
  310. same as the source (ie. "<code>-all:all>all:all</code>"), so the information is
  311. copied to the same family 1 group.</blockquote>
  312. <blockquote>Here are some examples to show you the type of control you have over
  313. where the information is written. All commands in each example are equivalent:
  314. <pre><span class='blk'># copy all tags to preferred groups (no destination group)</span>
  315. exiftool -tagsfromfile src.jpg dst.jpg
  316. exiftool -tagsfromfile src.jpg -all dst.jpg
  317. exiftool -tagsfromfile src.jpg "-all&gt;all" dst.jpg
  318. exiftool -tagsfromfile src.jpg "-all:all&gt;all" dst.jpg
  319. <span class='blk'># copy all tags, preserving family 1 group (destination group 'all')</span>
  320. exiftool -tagsfromfile src.jpg -all:all dst.jpg
  321. exiftool -tagsfromfile src.jpg "-all&gt;all:all" dst.jpg
  322. exiftool -tagsfromfile src.jpg "-all:all&gt;all:all" dst.jpg
  323. <span class='blk'># copy all tags to EXIF group (destination group 'exif')
  324. # [the destination family 1 group is the preferred EXIF IFD]</span>
  325. exiftool -tagsfromfile src.jpg "-all&gt;exif:all" dst.jpg
  326. exiftool -tagsfromfile src.jpg "-all:all&gt;exif:all" dst.jpg
  327. <span class='blk'># copy XMP tags to XMP group (destination group 'xmp')
  328. # [the destination family 1 group is the preferred XMP namespace]</span>
  329. exiftool -tagsfromfile src.jpg "-xmp:all" dst.jpg
  330. exiftool -tagsfromfile src.jpg "-xmp:all&gt;xmp:all" dst.jpg
  331. <span class='blk'># copy XMP tags, preserving family 1 group (destination group 'all')</span>
  332. exiftool -tagsfromfile src.jpg "-xmp:all&gt;all:all" dst.jpg
  333. <span class='blk'># copy XMP tags to preferred groups (no destination group)</span>
  334. exiftool -tagsfromfile src.jpg "-xmp:all&gt;all" dst.jpg
  335. <span class='blk'># copy XMP tags to EXIF only (destination group 'exif')
  336. # [the destination family 1 group is the preferred EXIF IFD]</span>
  337. exiftool -tagsfromfile src.jpg "-xmp:all&gt;exif:all" dst.jpg
  338. </pre>
  339. The same rules illustrated above also apply when copying individual tags.</blockquote>
  340. <blockquote>Note: If no destination group is specified, a new tag is created if
  341. necessary only in the preferred group, but if the same tag already exists in
  342. another group, then this information is also updated. (Otherwise inconsistent
  343. values for the same information would exist in different locations. Of course,
  344. you can always generate inconsistencies like this if you really want to by
  345. specifically writing contradictory information to different groups.)
  346. </blockquote>
  347. <blockquote>Certain types of meta information (such as EXIF, IPTC, XMP and
  348. ICC_Profile) may also be <b>copied as a block</b>. This technique copies all
  349. meta information, even if ExifTool doesn't have the ability to write some
  350. individual tags contained in the block. For all block types except EXIF, the
  351. metadata is copied byte-for-byte from the original image. With EXIF however,
  352. the metadata may be restructured to ensure that it is self-contained. Also note
  353. that EXIF may not be written as a block to TIFF-based file formats. Beware that
  354. <b>any existing metadata</b> of this type in the distination file <b>will be
  355. overwritten</b> by the new block.
  356. <pre><span class='blk'># copy EXIF as a block between same-named JPG files in different directories</span>
  357. exiftool -tagsfromfile SRCDIR/%f.%e -exif -ext jpg DSTDIR
  358. <span class='blk'># copy XMP as a block from one file to another</span>
  359. exiftool -tagsfromfile src.jpg -xmp dst.cr2
  360. </pre></blockquote>
  361. <a name="Q10"></a>
  362. <p>10. <b>"How does ExifTool handle coded character sets?"</b></p>
  363. <!-- vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv -->
  364. <!-- NOTE: CHANGES TO FAQ 10 MUST ALSO BE REFLECTED IN ExifTool.pod! -->
  365. <blockquote><i>[Also see <a href="#Q18">FAQ number 18</a> for help on displaying
  366. special characters in a Windows console.]</i></blockquote>
  367. <blockquote>Certain meta information formats allow coded character sets other
  368. than plain ASCII. When reading, most known encodings are converted to the
  369. external character set according to the exiftool "<code>-charset CHARSET</code>"
  370. or <code>-L</code> option, or to UTF&#8209;8 by default. When writing, the
  371. inverse conversion is performed. Alternatively, special characters may be
  372. converted to/from HTML character entities with the <code>-E</code> option.
  373. </blockquote>
  374. <blockquote>A distinction is made between the <b>external</b> character set
  375. visible to the ExifTool user, and the <b>internal</b> character used to store
  376. text in the metadata of a file. These character sets may be specified
  377. separately as follows:
  378. <ol><li>The <b>external</b> character set for <b>tag values</b> passed to/from
  379. ExifTool is UTF&#8209;8 by default, but it may be changed through any of these
  380. command-line options:
  381. <blockquote><code>-charset CHARSET</code> &nbsp; or &nbsp;
  382. <code>-charset exiftool=CHARSET</code> &nbsp; or &nbsp; <code>-L</code>
  383. </blockquote>
  384. The encoding of <b>file and directory names</b> (eg. the <i>FILE</i> argument on
  385. the command line) is different. By default, these names are passed straight
  386. through to the standard C I/O routines without recoding. On Mac/Linux these
  387. routines expect UTF&#8209;8, but on Windows they use the system code page (which
  388. is dependent on your system settings). However, as of ExifTool 9.79, the
  389. external filename encoding may be specified:
  390. <blockquote><code>-charset filename=CHARSET</code></blockquote>
  391. When this is done, file and directory names are converted from the specified
  392. encoding to one appropriate for system I/O routines. In Windows, this also has
  393. the effect of enabling Unicode filename support via the special Windows
  394. wide-character I/O routines if the required Perl modules are available
  395. (these are included in the Windows executable version of ExifTool). See
  396. <a href="exiftool_pod.html#windows_unicode_file_names">WINDOWS UNICODE FILE NAMES</a>
  397. in the application documentation for more details.<br><br></li>
  398. <li>The <b>internal</b> character set for strings stored in file metadata may be
  399. specified for some metadata types:
  400. <blockquote><code>-charset TYPE=CHARSET</code></blockquote>
  401. (where <code>TYPE</code> is "<code>exif</code>", "<code>iptc</code>",
  402. "<code>id3</code>", "<code>photoshop</code>" or "<code>quicktime</code>")</li></ol>
  403. Valid <code>CHARSET</code> values are (with aliases given in brackets):
  404. <blockquote><table class=clear>
  405. <tr><td>UTF8</td><td>(cp65001, UTF&#8209;8)</td><td>Thai</td><td>(cp874)</td></tr>
  406. <tr><td>Latin</td><td>(cp1252, Latin1)</td><td>MacRoman</td><td>(cp10000, Mac, Roman)</td></tr>
  407. <tr><td>Latin2</td><td>(cp1250)</td><td>MacLatin2</td><td>(cp10029)</td></tr>
  408. <tr><td>Cyrillic</td><td>(cp1251,&nbsp;Russian)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>MacCyrillic</td><td>(cp10007)</td></tr>
  409. <tr><td>Greek</td><td>(cp1253)</td><td>MacGreek</td><td>(cp10006)</td></tr>
  410. <tr><td>Turkish</td><td>(cp1254)</td><td>MacTurkish</td><td>(cp10081)</td></tr>
  411. <tr><td>Hebrew</td><td>(cp1255)</td><td>MacRomanian</td><td>(cp10010)</td></tr>
  412. <tr><td>Arabic</td><td>(cp1256)</td><td>MacIceland</td><td>(cp10079)</td></tr>
  413. <tr><td>Baltic</td><td>(cp1257)</td><td>MacCroatian</td><td>(cp10082)</td></tr>
  414. <tr><td>Vietnam</td><td>(cp1258)</td></tr>
  415. </table></blockquote>
  416. The <code>-L</code> option is equivalent to "<code>-charset Latin</code>",
  417. "<code>-charset Latin1</code>" and "<code>-charset cp1252</code>".</blockquote>
  418. <blockquote>Type-specific details are given below about the special character
  419. handling for EXIF, IPTC, XMP, PNG, ID3, PDF, Photoshop, QuickTime, AIFF, MIE and
  420. Vorbis information:</blockquote>
  421. <!-- NOTE: CHANGES TO FAQ 10 MUST ALSO BE REFLECTED IN ExifTool.pod! -->
  422. <blockquote><b>EXIF</b>: Most textual information in EXIF is stored in ASCII
  423. format (called "string" in the <a href="TagNames/index.html">ExifTool tag name
  424. documentation</a>). By default ExifTool does not convert these strings.
  425. However, it is not uncommon for applications to write UTF&#8209;8 or other
  426. encodings where ASCII is expected. To deal with these, ExifTool allows the
  427. internal EXIF string encoding to be specified with
  428. "<code>-charset exif=CHARSET</code>", which causes EXIF string values to be
  429. converted from the specified character set when reading, and stored with this
  430. character set when writing. (The
  431. <a href="http://www.metadataworkinggroup.org/">MWG</a> recommends using
  432. UTF&#8209;8 encoding for EXIF strings, and in keeping with this the
  433. "<code>-use mwg</code>" feature sets the default internal EXIF string encoding
  434. to UTF&#8209;8, but note that this will have no effect unless the external
  435. encoding is also set to something other than the default of UTF&#8209;8.)</blockquote>
  436. <blockquote>A few EXIF tags (UserComment, GPSProcessingMethod and
  437. GPSAreaInformation) support a designated internal text encoding, with values
  438. stored as ASCII, Unicode (UCS&#8209;2) or JIS. When reading these tags, ExifTool
  439. converts Unicode and JIS to the external character set specified by the
  440. <code>-charset</code> or <code>-L</code> option, or to UTF&#8209;8 by default.
  441. ASCII text is not converted. When writing, text is stored as ASCII unless the
  442. string contains special characters, in which case it is converted from the
  443. external character set (UTF&#8209;8 by default), and stored as Unicode. ExifTool
  444. writes Unicode in native EXIF byte ordering by default, but the byte order may
  445. be specified by setting the ExifUnicodeByteOrder tag (see the
  446. <a href="TagNames/Extra.html">Extra Tags</a> documentation).</blockquote>
  447. <blockquote>The EXIF "XP" tags (XPTitle, XPComment, etc) are always stored
  448. internally as little-endian Unicode (UCS&#8209;2), and are read and written
  449. using the specified external character set.</blockquote>
  450. <!-- NOTE: CHANGES TO FAQ 10 MUST ALSO BE REFLECTED IN ExifTool.pod! -->
  451. <blockquote><b>IPTC</b><span class='sm'><sup>&dagger;</sup></span>: The
  452. value of the IPTC:CodedCharacterSet tag determines how the internal IPTC string
  453. values are interpreted. If CodedCharacterSet exists and has a value of
  454. "<code>UTF8</code>" (or "<code>ESC&nbsp;%&nbsp;G</code>") then string values are
  455. assumed to be stored as UTF&#8209;8. Otherwise the internal IPTC encoding is
  456. assumed to be Windows Latin1 (cp1252), but this can be changed with
  457. "<code>-charset iptc=CHARSET</code>". When reading, these strings are converted
  458. to UTF&#8209;8 by default, or to the character set specified by the
  459. <code>-charset</code> or <code>-L</code> option. When writing, the inverse
  460. conversions are performed. No conversion is done if the internal (IPTC) and
  461. external (ExifTool) character sets are the same. Note that ISO 2022 character
  462. set shifting is not supported. Instead, a warning is issued and the string is
  463. not converted if an ISO 2022 shift code is encountered. See the
  464. <a href="http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf">IPTC IIM
  465. specification</a> for more information about IPTC character coding.</blockquote>
  466. <blockquote>ExifTool may be used to convert IPTC values to a different internal
  467. encoding. To do this, all IPTC tags must be rewritten along with the desired
  468. value of CodedCharacterSet. For example, the following command changes the
  469. internal IPTC encoding to UTF&#8209;8 (from Windows Latin1 unless
  470. CodedCharacterSet was already "UTF8"):
  471. <pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset=utf8 a.jpg
  472. </pre>or from Windows Latin2 (cp1250) to UTF&#8209;8:
  473. <pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset=utf8 -charset iptc=latin2 a.jpg
  474. </pre>and this command changes it back from UTF&#8209;8 to Windows Latin1 (cp1252):
  475. <pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset= a.jpg
  476. </pre>or to Windows Latin2:
  477. <pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset= -charset iptc=latin2 a.jpg
  478. </pre>Note that unless CodedCharacterSet is UTF&#8209;8, applications have no
  479. reliable way to determine the IPTC character encoding. For this reason, it is
  480. recommended that CodedCharacterSet be set to "<code>UTF8</code>" when creating
  481. new IPTC.</blockquote>
  482. <blockquote class='sm'><sup>&dagger;</sup> <span class=lt>Refers to the older
  483. <a href="http://www.iptc.org/site/News_Exchange_Formats/IIM/">IPTC IIM</a> format.
  484. The more recent
  485. <a href="http://iptc.cms.apa.at/site/Photo_Metadata/IPTC_Core_&amp;_Extension/">IPTC
  486. Core and Extension specifications</a> actually use the XMP format (see below).</span>
  487. </blockquote>
  488. <!-- NOTE: CHANGES TO FAQ 10 MUST ALSO BE REFLECTED IN ExifTool.pod! -->
  489. <blockquote><b>XMP</b>: Exiftool reads XMP encoded as UTF&#8209;8, UTF&#8209;16
  490. or UTF&#8209;32, and converts them all to UTF&#8209;8 internally. Also, all XML
  491. character entity references and numeric character references are converted.
  492. When writing, ExifTool always encodes XMP as UTF&#8209;8, converting the
  493. following 5 characters to XML character references: <code>&amp; &lt; &gt; &#39;
  494. &quot;</code>. By default no further conversion is performed, however the
  495. <code>-charset</code> or <code>-L</code> option may be used used to convert
  496. text to/from a specified character set when reading/writing.</blockquote>
  497. <blockquote><b>PNG</b>: <a href="TagNames/PNG.html#TextualData">PNG TextualData
  498. tags</a> are stored as tEXt, zTXt and iTXt chunks in PNG images. The tEXt and
  499. zTXt chunks use ISO 8859-1 encoding, while iTXt uses UTF&#8209;8. When reading,
  500. ExifTool converts all PNG textual data to the character set specified by the
  501. <code>-charset</code> or <code>-L</code> option, or to UTF&#8209;8 by default.
  502. When writing, ExifTool generates a tEXt chunk (or zTXt with the <code>-z</code>
  503. option) if the text doesn't contain special characters or if Latin encoding is
  504. specified (<code>-L</code> or <code>-charset latin</code>); otherwise an iTXt
  505. chunk is used and the text is converted from the specified character set and
  506. stored as UTF&#8209;8.</blockquote>
  507. <blockquote><b>JPEG Comment</b>: The encoding for the JPEG Comment (COM segment)
  508. is not specified, so ExifTool reads/writes this text without
  509. conversion.</blockquote>
  510. <blockquote><b>ID3</b>: The ID3v1 specification officially supports only ISO
  511. 8859&#8209;1 encoding (a subset of Windows Latin1), although some applications
  512. may incorrectly use other character sets. By default ExifTool converts ID3v1
  513. text from Latin to the character set specified by the <code>-charset</code> or
  514. <code>-L</code> option, or to UTF&#8209;8 by default. However, the internal
  515. ID3v1 charset may be specified with "<code>-charset id3=CHARSET</code>". The
  516. encoding for ID3v2 information is stored in the file, so ExifTool converts
  517. ID3v2 text from this encoding to the character set specified by
  518. <code>-charset</code> or <code>-L</code>, or to UTF&#8209;8 by default. ExifTool
  519. does not currently write ID3 information.</blockquote>
  520. <blockquote><b>PDF</b>: PDF text strings are stored in either PDFDocEncoding
  521. (similar to Windows Latin1) or Unicode (UCS&#8209;2). When reading, ExifTool
  522. converts to the character set specified by the <code>-charset</code> or
  523. <code>-L</code> option, or to UTF&#8209;8 by default. When writing, ExifTool
  524. encodes input text from the specified character set as Unicode only if the
  525. string contains special characters, otherwise PDFDocEncoding is
  526. used.</blockquote>
  527. <blockquote><b>Photoshop</b>: Some Photoshop resource names are stored as
  528. Pascal strings with unknown encoding. By default, ExifTool assumes MacRoman
  529. encoding and converts this to UTF&#8209;8, but the internal and external
  530. character sets may be specified with <code>-charset Photoshop=CHARSET</code>
  531. and <code>-charset CHARSET</code> respectively.</blockquote>
  532. <blockquote><b>QuickTime</b>: QuickTime text strings may be stored in a
  533. variety of poorly documented formats, and ExifTool does its best to decode
  534. these according to the <code>-charset</code> option setting. For some
  535. QuickTime strings where the internal encoding is not known, ExifTool assumes
  536. a default encoding of MacRoman, but this may be changed with
  537. "<code>-charset QuickTime=CHARSET</code>".</blockquote>
  538. <blockquote><b>AIFF</b>: AIFF strings are assumed to be stored in MacRoman, and
  539. are converted according to the <code>-charset</code> option when reading.
  540. </blockquote>
  541. <blockquote><b>MIE</b>: MIE strings are stored as either UTF&#8209;8 or ISO
  542. 8859&#8209;1. When reading, UTF&#8209;8 strings are converted according to
  543. the <code>-charset</code> or <code>-L</code> option, and ISO 8859&#8209;1
  544. strings are never converted. When writing, input strings are converted from
  545. the specified character set to UTF&#8209;8. The resulting strings are stored as
  546. UTF&#8209;8 if they contain multi-byte UTF&#8209;8 character sequences,
  547. otherwise they are stored as ISO 8859&#8209;1.</blockquote>
  548. <blockquote><b>Vorbis</b>: Vorbis comments are stored as UTF&#8209;8,
  549. and are converted to the character set specified by <code>-charset</code> or
  550. <code>-L</code> when reading.</blockquote>
  551. <blockquote class=prog>
  552. <b>Programmers</b>: ExifTool returns all values as byte strings of encoded
  553. characters. Perl wide characters are not used. The encoding is UTF&#8209;8 by
  554. default, but valid UTF&#8209;8 can not be guaranteed for all values, so the
  555. caller must validate the encoding if necessary. The encodings described above
  556. are set by the various <a href="ExifTool.html#Charset">Charset options</a> of
  557. the API.
  558. <br><br><b>Note</b>: Some settings of the system PERL_UNICODE environment
  559. variable may be incompatible with ExifTool's character handling.
  560. </blockquote>
  561. <!-- NOTE: CHANGES TO FAQ 10 MUST ALSO BE REFLECTED IN ExifTool.pod! -->
  562. <!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
  563. <a name="Q11"></a>
  564. <p>11. <b>"My user-defined tags don't work"</b></p>
  565. <blockquote>
  566. For examples of how to add user-defined tags, see the
  567. <a href="config.html">ExifTool_config</a> file in the ExifTool distribution.
  568. It may be useful to activate this file as a test before trying to implement
  569. your own config file. To activate this file, copy it to your <b>HOME</b>
  570. directory then rename it to "<code>.ExifTool_config</code>".
  571. <blockquote class=lt><b>Note</b>: The config file must be renamed at the
  572. command line because neither the Windows nor Mac GUI allow a file name to
  573. begin with a "<code>.</code>". To do this in Windows, run "cmd.exe" and type
  574. the following (pressing <i>RETURN</i> at the end of each line):
  575. <pre>cd %HOMEPATH%
  576. rename ExifTool_config .ExifTool_config
  577. </pre>
  578. or on a Mac, open the "Terminal" application (from the /Applications/Utilities
  579. folder) and type this command then press <i>RETURN</i>:
  580. <pre>mv ExifTool_config .ExifTool_config
  581. </pre></blockquote>
  582. With the sample config file installed, you should be able to write the example
  583. tags. A command like this:
  584. <pre>exiftool -v2 -NewXMPxmpTag=test <i>FILE</i></pre>
  585. should print this as the first line of its output:
  586. <pre>Writing XMP-xmp:NewXMPxmpTag
  587. </pre>
  588. If this doesn't work, the most common problem is that the
  589. "<code>.ExifTool_config</code>" configuration file isn't getting loaded. In
  590. this case, there are a few things you can try:
  591. <ol>
  592. <li>Make sure the config file name is correct. It must be
  593. "<code>.ExifTool_config</code>" (note the leading "<code>.</code>", and the
  594. capital "<code>T</code>").</li>
  595. <li>Set either the <b>HOME</b> or the <b>EXIFTOOL_HOME</b> environment variable
  596. to the name of the directory where you put your "<code>.ExifTool_config</code>"
  597. file.</li>
  598. <li>Put the config file in the same directory as the exiftool script. (Also, be
  599. sure the config filename starts with a dot! See the note above for help
  600. renaming the config file.)</li>
  601. <li>If you can't get the config file to load automatically, you can try loading
  602. it manually with the exiftool <code>-config <i>CFGFILE</i></code> option. (Note:
  603. This must be the first option on the command line.) This allows loading
  604. of a config file with any name.</li>
  605. </ol>
  606. </blockquote>
  607. <blockquote>If necessary, you can verify that ExifTool is loading your config
  608. file by adding the following line to your file:
  609. <pre>print "LOADED!\n";
  610. </pre>
  611. If you see a "<code>LOADED!</code>" message when you run exiftool, but your new
  612. tags still don't work, make sure you are using the proper tag name and that the
  613. file you are writing can support this type of information.</blockquote>
  614. <blockquote>Note that all tag names in the config file are <b>case
  615. sensitive</b>. Specifically, the case must be correct for tag names in
  616. Composite tag Require/Desire entries. Also note that XMP tag names are
  617. generated automatically by capitalizing the tag ID unless the tag definition
  618. contains a "Name" entry.</blockquote>
  619. <blockquote class=prog><b>Programmers</b>: To specify the config file directory from within
  620. a Perl script when using the ExifTool API, set the <b>EXIFTOOL_HOME</b>
  621. environment variable before loading the ExifTool module:
  622. <pre>BEGIN { $ENV{EXIFTOOL_HOME} = '/config_file_directory' }
  623. use Image::ExifTool;
  624. </pre>
  625. Also see the <a href="ExifTool.html#Config">Configuration section of the
  626. ExifTool API documentation</a> for techniques to use a config file with another
  627. name, or to disable the config file feature.
  628. </blockquote>
  629. <a name="Q12"></a>
  630. <p>12. <b>"How do I export information from exiftool to a database?"</b></p>
  631. <blockquote><i>[See <a href="#Q26">FAQ number 26</a> for help with the reverse
  632. -- importing metadata from a database.]</i></blockquote>
  633. <blockquote>
  634. It is often easiest to export information formatted as a tab-delimited or
  635. comma-separated list of values using the exiftool <code>-T</code> or
  636. <code>-csv</code> option. As well, the <code>-r</code> option is useful for
  637. recursing through all images in a hierarchy of directories. For example:
  638. <pre>exiftool -T -r -filename -exposuremode -ISO t/images &gt; out.txt
  639. </pre>
  640. This command recursively processes all images in the "<code>t/images</code>"
  641. directory, extracting FileName, ExposureMode and ISO tags, and writing the
  642. output to a tab-delimited text file called "<code>out.txt</code>". After the
  643. command has executed, "<code>out.txt</code>" will look something like this:
  644. <pre>Canon.jpg Manual 100
  645. Casio.jpg - 64
  646. Nikon.jpg - 100
  647. OlympusE1.jpg Auto 400
  648. </pre>
  649. One limitation of the <code>-T</code> option is that a list of tags to extract
  650. must be specified. Otherwise, all information is extracted from each input
  651. file, and the columns would contain values from random tags.</blockquote>
  652. <blockquote> The <code>-csv</code> (comma separated values) option solves this
  653. dilemma by pre-extracting information from all input files, then producing a
  654. sorted list of available tag names as the first row of the output, and
  655. organizing the information into columns for each tag. As well, a first column
  656. labelled "SourceFile" is generated. These features make it practical to use the
  657. <code>-csv</code> option for extracting all information from multiple images.
  658. For example, this command:
  659. <pre>exiftool -csv -r t/images > out.csv</pre>
  660. gives an output like this:
  661. <pre>SourceFile,AEBBracketValue,AELock,AFAreaHeight,AFAreaMode,AFAreas,[...]
  662. t/images/Canon.jpg,0,,151,,,[...]
  663. t/images/Casio.jpg,,,,,,[...]
  664. t/images/Nikon.jpg,,,,Single Area,,[...]
  665. t/images/OlympusE1.jpg,,Off,,,"Center (121,121)-(133,133)",[...]
  666. </pre>
  667. Note that the number of columns in the <code>-csv</code> output may be very
  668. large if all information is extracted. Missing tags are indicated by empty
  669. strings as in the example above, or by dashes if the <code>-f</code> option is
  670. used.</blockquote>
  671. <blockquote> It should be possible to import these files directly into most
  672. database applications. On the command line, any list of tag names may be used,
  673. and any number of file or directory names may be specified. (Hint: If your
  674. command line starts to get too long, you may want to look into using the
  675. <code>-@</code> option and/or the <a href="index.html#shortcut">ShortCut</a>
  676. feature).</blockquote>
  677. <blockquote>In Windows, a .BAT file containing the exiftool command may be used
  678. to give drag and drop functionality. Dropping a folder on the following .BAT
  679. file will create "out.txt" in the folder:
  680. <pre>echo "FileName&lt;tab&gt;Aperture&lt;tab&gt;ISO" &gt; %1\out.txt
  681. exiftool -T -r -filename -aperture -ISO %1 &gt;&gt; %1\out.txt
  682. </pre>
  683. The "<code>echo</code>" command was included to add column headings to the
  684. output. (The tab character in the echo command, indicated by
  685. "<code>&lt;tab&gt;</code>", may be generated in Mac/Linux shells with CTRL-v
  686. then TAB, or in a Windows cmd shell with TAB when cmd.exe is run with the
  687. <code>/f:off</code> option to disable tab completion.)
  688. </blockquote>
  689. <blockquote>Other possible export formats include RDF/XML (with the the
  690. <code>-X</code> option), or JSON (with the <code>-j</code> option). These
  691. methods allow transfer of more complex data sets (including structured
  692. information with the <code>-struct</code> option), but require that the
  693. importing software supports these formats.</blockquote>
  694. <blockquote>Finally, the <code>-p</code> option may be used to generate any
  695. arbitrary output format. For example, the following format file
  696. (let's call it "<code>my.fmt</code>") may be used to emulate a CSV-formatted
  697. output:
  698. <pre>#[HEAD]FileName, Aperture, ISO
  699. $filename, $aperture, $iso
  700. </pre>
  701. with a command like this:
  702. <pre>exiftool -f -r -p my.fmt t/images &gt; out.csv
  703. </pre>
  704. Alternatively, the <code>-p</code> option may be used with a format string instead
  705. of a file name. The following command has the same effect as above except that
  706. the row of headings is not printed (Note: Use single quotes as below on Mac/Linux,
  707. or double quotes instead on Windows):
  708. <pre>exiftool -f -r -p '$filename, $aperture, $iso' t/images &gt; out.csv
  709. </pre>
  710. With the <code>-f</code> option, the value of any missing tag is printed as a
  711. dash. Without this option, missing tags generate a minor warning and the
  712. line in the <code>-p</code> output is not printed. The <code>-m</code> option
  713. may be used to ignore minor warnings, which causes these lines to be printed
  714. with an empty value for missing tags.</blockquote>
  715. <blockquote>
  716. See the <code>-p</code> option in the <a href="exiftool_pod.html">application
  717. documentation</a> for more information about this feature.
  718. </blockquote>
  719. <a name="Q13"></a>
  720. <p>13a. <b>"Why is my file smaller after I use ExifTool to write information?"</b>, or
  721. <br>13b. <b>"Why do some Offset tags change value when I write other tags?"</b></p>
  722. <blockquote>
  723. There are various specific reasons why this can happen, but the general answer
  724. is: When ExifTool writes an image, the meta information may be restructured in
  725. such a way that it takes less space than in the original file, or so that some
  726. tags are stored at different offsets in the file.</blockquote>
  727. <blockquote>The EXIF/TIFF standard allows for blocks of unreferenced data to
  728. exist in an image. Some digital cameras write JPEG or TIFF-based RAW files
  729. which contain large blocks of unused data, usually filled with binary zeros.
  730. The reason for this could be to simplify camera algorithms by allowing
  731. variable-sized information to be written at fixed offsets in the output image.
  732. When ExifTool rewrites an image it does not copy these unused blocks. This can
  733. result in a significant reduction in file size for some images. <i>[The
  734. <code>-htmlDump</code> option may be used to view the file structure if you are
  735. interested in seeing these unused data blocks -- use a command like
  736. "<code>exiftool -htmlDump a.jpg &gt; out.html</code>", then open
  737. <code>out.html</code> in your web browser. Unused data blocks are
  738. <span class=U>brown</span> in this output.]</i> </blockquote>
  739. <blockquote>Also, the size of an XMP record may easily shrink or grow when it is
  740. rewritten, even if no meta information is changed. This is partly due to the
  741. fact that the XMP specification recommends a few KB of padding at the end of the
  742. record (ExifTool adds 2424 bytes by default, but this padding is omitted if the
  743. <code>-z</code> option is used), and partly due to the flexibility of the XMP
  744. format which allows the information to be written in various styles, some of
  745. which are more compact than others.
  746. </blockquote>
  747. <blockquote>You may also notice that the values of some "offset" tags (like
  748. ThumbnailOffset and PreviewImageStart) may change when the file is rewritten.
  749. This is normal, and simply indicates that the associated data is now stored at a
  750. different position within the file.</blockquote>
  751. <blockquote>ExifTool does not modify the image data itself, so editing a file is
  752. "lossless" as far as the image is concerned.</blockquote>
  753. <a name="Q14"></a>
  754. <p>14. <b>"What format do I use for writing GPS coordinates?"</b></p>
  755. <blockquote>ExifTool is very flexible in the formats allowed for entering GPS
  756. coordinates. Any string containing between 1 and 3 floating point numbers is
  757. valid. The numbers represent degrees, (and optionally) minutes and
  758. seconds.</blockquote>
  759. <blockquote>For EXIF GPS coordinates, the reference direction is specified
  760. separately with the EXIF:GPSLatitudeRef or EXIF:GPSLongitudeRef
  761. tag.</blockquote>
  762. <blockquote>For XMP GPS coordinates, the reference direction is specified within
  763. the XMP:GPSLatitude or XMP:GPSLongitude value, with west longitudes and south
  764. latitudes being specified either by negative coordinate values or by ending the
  765. string with "<code>W</code>" or "<code>S</code>". </blockquote>
  766. <blockquote>Here are some examples of equivalent ways to specify a GPS
  767. latitude in both EXIF and XMP:
  768. <pre>exiftool -exif:gpslatitude="42 30 0.00" -exif:gpslatituderef=S a.jpg
  769. exiftool -exif:gpslatitude="42 deg 30.00 min" -exif:gpslatituderef=S a.jpg
  770. exiftool -exif:gpslatitude=42.5 -exif:gpslatituderef=S a.jpg
  771. exiftool -xmp:gpslatitude="42 30 0.00 S" a.jpg
  772. exiftool -xmp:gpslatitude=42.50S a.jpg
  773. exiftool -xmp:gpslatitude=-42.5 a.jpg
  774. </pre>
  775. Similar styles may be used for longitude. ExifTool will convert any of these
  776. coordinate styles to the proper format for the specific tag used.
  777. </blockquote>
  778. <blockquote>When reading, ExifTool reports coordinates in the format
  779. <pre>DDD deg MM' SS.SS"</pre>
  780. where <code>DDD</code> is degress, <code>MM</code> is minutes, and <code>SS.SS</code>
  781. is seconds. The <code>-n</code> option may be used to change this to decimal
  782. degrees, or any arbitrary format may be specified with the <code>-c</code> option.
  783. See the <a href="exiftool_pod.html">application documentation</a> for details.
  784. </blockquote>
  785. <a name="Q15"></a>
  786. <p>15. <b>"I get MakerNote warnings or errors when reading or writing information"</b></p>
  787. <blockquote>Problems like this may be caused by image editing software which
  788. doesn't properly update offsets in the MakerNotes when rewriting an image. These
  789. offsets are used as pointers to reference tag values and structures within the
  790. metadata, and errors like this may lead to missing or incorrect values for some
  791. MakerNotes tags. In many cases, ExifTool will detect this type of problem and
  792. issue a warning like this when reading (or an error when writing):
  793. <pre>Warning: [minor] Possibly incorrect maker notes offsets (fix by -340?)
  794. </pre>
  795. <i class=lt>[Be aware that if multiple warnings occur, the <code>-a</code>
  796. option must be used to see them all, since by default only one warning is
  797. displayed per file.]</i> </blockquote>
  798. <blockquote>This is a particularly insidious problem that is sometimes difficult
  799. for ExifTool to correct automagically, so it requires some operator
  800. intervention. If this warning occurs, you have a few alternatives:</blockquote>
  801. <blockquote>1) Use the <code>-F</code> option to allow ExifTool to attempt to
  802. fix the incorrect offsets. If ExifTool was correct in its diagnosis, then this
  803. option will fix the incorrect offsets. This is usually the appropriate choice
  804. if this problem was caused by editing the image with other
  805. software.</blockquote>
  806. <blockquote>2) Use the <code>-m</code> option to ignore the warning (or downgrade
  807. the error to a warning when writing). This causes ExifTool to honour the
  808. existing maker note offsets, and may be the correct choice if images straight
  809. out of the camera have this problem.</blockquote>
  810. <blockquote>Often, the first choice (<code>-F</code>) is the right thing to do,
  811. but this depends on many factors, so it is best to try both methods then compare
  812. the resulting maker note information to see which works best for your
  813. situation.</blockquote>
  814. <blockquote>When writing, <code>-F</code> applies a permanent correction to the
  815. maker notes. Note that <u>some MakerNote information may be lost permanently
  816. if the proper correction is not applied when writing images with this
  817. problem</u>.</blockquote>
  818. <blockquote>3) The third alternative is to adjust the maker note offsets by a
  819. specific amount. This is done by appending an integer to the <code>-F</code>
  820. option. For example, with the warning above (where ExifTool suggests "fix by
  821. -340?"), <code>-F</code> would be equivalent to <code>-F-340</code>. See the
  822. <a href="exiftool_pod.html#f_offset_fixbase">-F option documentation</a> for
  823. more details. This advanced feature may require some technical knowledge about
  824. the structure of EXIF information (and here, ExifTool's <code>-htmlDump</code>
  825. feature may be very useful for visualizing this structure).</blockquote>
  826. <blockquote>Other types of MakerNote errors may also prevent the file from
  827. being written. However, most MakerNote errors are designated as <b>minor</b>,
  828. which allows them to be ignored by using the <code>-m</code> option. For
  829. example:
  830. <pre>Error: [minor] Bad format (65535) for MakerNotes entry 17
  831. </pre>
  832. Using <code>-m</code> will downgrade the minor error to a warning, allowing the
  833. file to be written, but <u>some MakerNote information may be lost when ignoring
  834. certain types of errors like this</u>. </blockquote>
  835. <a name="Q16"></a>
  836. <p>16. <b>"Why doesn't ExifTool rename my AVI files?"</b></p>
  837. <blockquote>By default, ExifTool only processes <u>writable file
  838. types</u><span class='sm'><sup>&dagger;</sup></span> when <u>any
  839. tag</u><span class='sm'><sup>&Dagger;</sup></span> is being written and a
  840. directory name is specified on the command line. To force exiftool to process
  841. other files, they must either be listed on the command line by name, or be
  842. specified using the <code>-ext</code> option, something like this:
  843. <pre>exiftool -ext AVI -ext JPG -d pics/%Y/%m "-directory&lt;dateTimeOriginal" DIR
  844. </pre>
  845. When a single <code>-ext</code> option is used, only files of the specified type
  846. are processed. However, multiple <code>-ext</code> options may be used in the
  847. same command (as in the example above) to process any number of different file
  848. types.
  849. </blockquote>
  850. <blockquote class='sm'><sup>&dagger;</sup> <span class=lt>The
  851. <code>-listwf</code> option may be used to list the extensions of all writable file types.</span>
  852. <br><sup>&Dagger;</sup> <span class=lt>This includes "pseudo" tags like
  853. FileName, Directory, FileModifyDate and FileCreateDate.</span></blockquote>
  854. <a name="Q17"></a>
  855. <p>17. <b>"List-type tags do not behave as expected"</b></p>
  856. <blockquote>Tags indicated by a plus sign (<code>+</code>) in the
  857. <a href="TagNames/index.html">tag name documentation</a> are list-type tags.
  858. Two examples of common list-type tags are
  859. <a href="TagNames/IPTC.html#ApplicationRecord">IPTC:Keywords</a> and
  860. <a href="TagNames/XMP.html#dc">XMP:Subject</a>. These tags may contain multiple
  861. items which are combined into a single string when reading. (By default,
  862. extracted list items are separated by a comma and a space, but the
  863. <code>-sep</code> option may be used to change this.) When writing, separate
  864. items are assigned individually. For example, the following command writes
  865. three keywords to all writable files in directory <code>DIR</code>, replacing
  866. any previously existing keywords:
  867. <pre>exiftool -keywords=one -keywords=two -keywords=three DIR
  868. </pre>
  869. List items are assigned separately, NOT all together, because this would
  870. represent a single keyword:
  871. <pre>exiftool -keywords="one, two, three" test.jpg <span class=blk>(WRONG!)</span>
  872. </pre>
  873. With exiftool version 7.56 or later, the <code>-sep</code> option may be used to
  874. split values of list-type tags into separate items when writing. For example,
  875. <pre>exiftool -sep ", " -keywords="one, two, three" DIR
  876. </pre>
  877. will store three separate keywords, the same as the first example above. This
  878. feature may also be used to split a tag value into separate items if it was
  879. originally stored incorrectly as a single string:
  880. <pre>exiftool -sep ", " -tagsfromfile @ -keywords test.jpg
  881. </pre>
  882. However, sometimes it is desirable to have list items which contain a comma, and
  883. this is allowed:
  884. <pre>exiftool -contributor="Harvey, Phil" -contributor="Marley, Bob" a.jpg
  885. </pre>
  886. But to distinguish these entries when extracting information, a different list
  887. separator or a different output format must be used. For instance, the
  888. following command uses "<code>//</code>" to separate list items,
  889. <pre>exiftool -contributor -sep "//" a.jpg
  890. </pre>
  891. and produces an output like this:
  892. <pre class=blk>Contributor : Harvey, Phil//Marley, Bob
  893. </pre>
  894. Alternatively, the <code>-j</code>, <code>-php</code> and <code>-X</code>
  895. options use an output format which preserves the structure of a
  896. list (if <code>-sep</code> is NOT used).</blockquote>
  897. <blockquote>Note that the writing examples above overwrite any values which
  898. already existed in the original file for these tags. Instead, to add or delete
  899. items from an existing list, use "<code>+=</code>" or "<code>-=</code>" in place
  900. of "<code>=</code>". For example:
  901. <pre>exiftool -keywords+="add this" -keywords-="remove this" DIR
  902. </pre>
  903. With commands like this, new items are added to the list in place of the first
  904. deleted item, or at the end of the list if no items were removed.</blockquote>
  905. <blockquote>Note: Using "<code>=</code>" is equivalent to "<code>+=</code>" in
  906. any command where the same tag is set with "<code>+=</code>" or
  907. "<code>-=</code>" in another assignment. (ie. existing items will be preserved
  908. unless specifically deleted with "<code>-=</code>".)</blockquote>
  909. <blockquote>To prevent duplication when adding new items, specific items can be
  910. deleted then added back again in the same command. For example, the following
  911. command adds the keywords "one" and "two", ensuring that they are not duplicated
  912. if they already existed in the keywords of an image:
  913. <pre>exiftool -keywords-=one -keywords+=one -keywords-=two -keywords+=two DIR
  914. </pre>
  915. When copying list tags using the <code>-tagsFromFile</code> option, items are
  916. copied individually to form proper lists. However, there is a complication when
  917. copying multiple tags to a single list tag: Here, any assignment to a tag
  918. overrides earlier assignments to the same tag in the command. For instance,
  919. this command
  920. <pre>exiftool "-keywords&lt;filename" "-keywords&lt;comment" DIR
  921. </pre>
  922. writes only the value from the Comment tag. (Note that <code>-tagsFromFile @</code>
  923. is implied by the "<code>&lt;</code>" operation in this command, causing tags to
  924. be copied from the original file.) This may seem strange, but it prevents
  925. duplicate items from being added to a list when copying a group of tags from a
  926. file containing duplicate information. Alternatively, the
  927. <code>-addTagsFromFile</code> option may be used to accumulate items when
  928. copying from multiple tags:
  929. <pre>exiftool -addTagsFromFile @ "-keywords&lt;filename" "-keywords&lt;comment" DIR
  930. </pre>
  931. Note that as with "<code>=</code>" in the first three examples above, the
  932. "<code>&lt;</code>" operation of this command overwrites any Keywords that
  933. existed previously in the original file. To add to or remove from the existing
  934. keywords, use "<code>+&lt;</code>" or "<code>-&lt;</code>".
  935. </blockquote>
  936. <a name="Q18"></a>
  937. <p>18. <b>"Special characters don't display properly in my Windows console"</b></p>
  938. <blockquote>The Windows cmd.exe console uses an MS-DOS encoding by default
  939. (cp437 or something similar, depending on your region). The exiftool
  940. <code>-charset</code> option may be used to encode the exiftool output for a
  941. specific Windows code page, which may help display some special characters, but
  942. instead it may be better to switch the console to UTF&#8209;8 (the native
  943. ExifTool character encoding). This is especially useful if you are using the
  944. <code>-lang</code> option to translate exiftool output to another language. To
  945. change the the Windows console to UTF&#8209;8, follow these steps:
  946. <ol><li>Run "cmd.exe" to open a Windows console (select "Run..." from the
  947. Start menu and enter "cmd").</li>
  948. <li>Change the font in the console Properties to any True Type font (eg. "TT
  949. Lucida Console").</li>
  950. <li>Type "<code>chcp 65001</code>" then press RETURN at the command prompt.</li>
  951. </ol>
  952. The console should now be able to display UTF&#8209;8 characters (cp65001). But
  953. note that the TT Lucida Console font shipped with Windows, at least my version,
  954. may not be very complete, and doesn't seem to contain Japanese or Chinese
  955. characters.</blockquote>
  956. <blockquote>To permanently set the font, select "Save properties for future
  957. windows" when changing the font Properties. Also, you can automatically run
  958. "<code>chcp 65001</code>" every time "cmd.exe" is launched by changing the
  959. Windows Registry for the Command Processor: Run "regedit" and put "<code>chcp
  960. 65001</code>" into Data field for "HKEY_LOCAL_MACHINE\Software\Microsoft\Command
  961. Processor\Autorun". (Unfortunately, I haven't been able to figure out how to
  962. change the code page for exiftool when launched via the Windows GUI. If anyone
  963. can figure out how to do this, please let me know.)
  964. </blockquote>
  965. <blockquote>On some Windows systems, using UTF&#8209;8 doesn't seem to work. In
  966. this case, a Windows character set may be the best alternative: For instance,
  967. for Windows Latin1 (cp1252) type "<code>chcp 1252</code>" in the console to
  968. switch to cp1252, then run exiftool with "<code>-charset cp1252</code>" (or
  969. <code>-L</code>). This same technique can be used for other supported Windows
  970. code pages.</blockquote>
  971. <blockquote>A final alternative is to bypass the command-line encoding problems
  972. totally by extracting/writing to/from a separate text file, and using a UTF&#8209;8
  973. aware text editor to view/edit the text. For example:
  974. <pre><span class=blk># extracting...</span>
  975. exiftool image.jpg &gt; out.txt
  976. <span class=blk># writing...</span>
  977. exiftool "-subject&lt;=subject.txt" image.jpg</pre></blockquote>
  978. <a name="Q19"></a>
  979. <p>19. <b>"How do I change the format of an extracted tag value?"</b></p>
  980. <blockquote>The exiftool application has built-in options which allow you to
  981. display numeric values (<code>-n</code>), escape special HTML characters
  982. (<code>-E</code>), and change the date/time (<code>-d</code>) and GPS coordinate
  983. (<code>-c</code>) formats, but sometimes more control is needed over the
  984. formatting of a value...</blockquote>
  985. <blockquote>The <code>-p</code> and <code>-tagsFromFile</code> options provide
  986. an advanced translation feature that allows arbitrary Perl expressions to be
  987. used to modify tag values. The basic syntax is this:
  988. <pre>${TAG;EXPR}</pre>
  989. where <code>TAG</code> is the tag name, and <code>EXPR</code> is a Perl
  990. expression acting on the default input variable (<code>$_</code>), which is
  991. initially the original value of the tag. For example, the following command
  992. sets the FileName from Artist, translating spaces to underlines:
  993. <pre>exiftool '-filename&lt;${artist;tr/ /_/}.%e' image.jpg</pre>
  994. (Note: Use single quotes as above in Mac/Linux, or double quotes instead
  995. in Windows.)</blockquote>
  996. <blockquote>Another technique is to create a user-defined Composite tag to do
  997. the reformatting. Here is a basic config file that reformats the Artist tag to
  998. provide a new MyArtist tag with the same character translation as the example
  999. above:
  1000. <pre>%Image::ExifTool::UserDefined = (
  1001. 'Image::ExifTool::Composite' => {
  1002. MyArtist => {
  1003. Require => 'Artist',
  1004. ValueConv => '$val =~ tr/ /_/; $val',
  1005. },
  1006. },
  1007. );
  1008. 1; # end
  1009. </pre>
  1010. With this config file, an Artist value of "Phil Harvey" yields a corresponding
  1011. MyArtist value of "Phil_Harvey". The ValueConv string may be any valid Perl
  1012. expression, and is evaluated to obtain the value for the new tag. In this
  1013. expression, <code>$val</code> represents the ValueConv value of the Require'd
  1014. tag. </blockquote>
  1015. <blockquote>To activate the config file, it must be named
  1016. "<code>.ExifTool_config</code>" and placed either in your home directory or in
  1017. the same directory as the exiftool application. Note that the file name begins
  1018. with a "<code>.</code>", so if you are in Windows or on a Mac you may need to
  1019. rename the file from the command line since the GUI might not like file names
  1020. beginning with a "<code>.</code>".</blockquote>
  1021. <blockquote>User-defined Composite tags have many other features, including the
  1022. ability to combine the values of multiple tags. See the
  1023. <a href="config.html">config file documentation</a> for more details about
  1024. user-defined tags, and lib/Image/ExifTool/README in the full distribution for a
  1025. complete description of ValueConv features. Also, a
  1026. <a href="http://u88.n24.queensu.ca/exiftool/forum/index.php?action=search2&amp;search=code+userdefined">quick
  1027. search of the ExifTool forum</a> should reveal a number of user-defined tag
  1028. examples, and there are other good (and often more complex) examples which can
  1029. be found in the %Image::ExifTool::Exif::Composite hash of the
  1030. lib/Image/ExifTool/Exif.pm source code.
  1031. </blockquote>
  1032. <a name="Q20"></a>
  1033. <p>20. <b>"ExifTool won't write an image due to errors"</b></p>
  1034. <blockquote>Minor errors may be ignored using the <code>-m</code> option
  1035. (<a href="#Q15">FAQ 15</a> discusses this with respect to MakerNote errors), but
  1036. sometimes there are more serious errors which can't be ignored. ExifTool may be
  1037. used to fix metadata problems in JPEG images by deleting all metadata and
  1038. rebuilding it from scratch. The command looks like this:
  1039. <pre>exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile bad.jpg
  1040. </pre>
  1041. where "<code>bad.jpg</code>" is the name of the image that requires fixing. This
  1042. command deletes all metadata then copies all writable tags that can be extracted
  1043. from the original image to the same locations in the updated image. The
  1044. "<code>Unsafe</code>" tag is a <a href="TagNames/Shortcuts.html">shortcut</a>
  1045. for unsafe EXIF tags in JPEG images which are not normally copied. JPEG images
  1046. may also contain an ICC color profile which should be preserved. The
  1047. "<code>ICC_Profile</code>" tag is also marked as unsafe, but is not part of the
  1048. EXIF so it isn't covered by the "<code>Unsafe</code>" shortcut and must be
  1049. specified separately.</blockquote>
  1050. <blockquote>After repairing an image like this you should be able to write to it
  1051. without errors, but note that <u>some metadata from the original image may have
  1052. been lost in the process</u>.</blockquote>
  1053. <blockquote><b>Note</b>: ExifTool will not modify the JPEG image data, so if the
  1054. image itself is corrupted (eg. if you get a message saying "Not a valid JPEG"),
  1055. then ExifTool can not be used to repair the image. Also, ExifTool may not
  1056. be used like this to repair TIFF-based files -- the risk of image corruption is
  1057. too great because the image is stored in the same IFD as the metadata in these
  1058. files.</blockquote>
  1059. <blockquote>If there are also MakerNote problems in the file, you may want to
  1060. add the <code>-F</code> option to the command. See <a href='#Q15'>FAQ 15</a>
  1061. for details. For example, to rebuild the EXIF only and fix the MakerNote
  1062. offsets you could do this:
  1063. <pre>exiftool -exif:all= -tagsfromfile @ -exif:all -unsafe -thumbnailimage -F bad.jpg
  1064. </pre>
  1065. <b>Advanced</b>: The byte order of the newly created EXIF is set by the value of
  1066. the ExifByteOrder tag. Since this tag does not belong to the EXIF group, it is
  1067. not copied with <code>-exif:all</code> above (but would be copied with
  1068. <code>-all:all</code> as in the first example). If ExifByteOrder is not set
  1069. then the byte order is determined by the ordering of the MakerNotes if they are
  1070. copied, otherwise big-endian ("MM") byte order is used by default.
  1071. ExifByteOrder may be set to a specific value to force a particular byte order
  1072. when creating new EXIF (eg. "<code>-ExifByteOrder=II</code>" for little-endian).
  1073. </blockquote>
  1074. <a name="Q21"></a>
  1075. <p>21. <b>"How do I read/write values containing newline characters?"</b></p>
  1076. <blockquote>When reading, by default exiftool converts all control characters to
  1077. "." to avoid messing up the output formatting, so newlines will appear as a "."
  1078. in the output. The <code>-b</code> option may be used to bypass all output
  1079. formatting (except that a line-feed character is inserted between items in a
  1080. list), but this may not be appropriate when the values of many tags must be
  1081. extracted. In this case, the formatted output (<code>-p</code>), JSON
  1082. (<code>-j</code>), XML (<code>-X</code>) and PHP (<code>-php</code>) options
  1083. provide alternative output formats which preserve newlines in values.</blockquote>
  1084. <blockquote>When writing, there are a number of options:
  1085. <ol type='a'>
  1086. <li>In many shells, a newline may be inserted directly in the command
  1087. line:
  1088. <p>Bourne shells (press <i>RETURN</i> inside a quoted string)</p>
  1089. <pre>exiftool -comment="line 1
  1090. line 2" image.jpg
  1091. </pre>
  1092. <p>(Also, in Bourne shells the character sequence <code>$'\n'</code>
  1093. may be used for a newline.)</p>
  1094. <p>C shells (press "<code>\</code>" then <i>RETURN</i> inside a quoted string)</p>
  1095. <pre>exiftool -comment="line 1\
  1096. line 2" image.jpg
  1097. </pre>
  1098. <i class=lt>[Unfortunately the Windows cmd shell provides no method to get a
  1099. newline (CR/LF in Windows) into the command line. A linefeed (LF) may be
  1100. inserted with CTRL-T, but I have found no way to insert a carriage return
  1101. (CR).]</i><br><br>
  1102. </li>
  1103. <li>Use the <code>-E</code> option to allow HTML character entities (Note:
  1104. In Windows a newline is "<code>&amp;#xd;&amp;#xa;</code>" instead of just
  1105. "<code>&amp;#xa;</code>"):
  1106. <pre>exiftool -E "-comment=line 1&amp;#xa;line 2" image.jpg
  1107. </pre></li>
  1108. <li>Write the tag from the contents of a separate text file:
  1109. <pre>exiftool "-comment&lt;=file.txt" image.jpg
  1110. </pre></li>
  1111. <li>Use <code>$/</code> in a redirection expression: (Note: Single quotes
  1112. must be used in Mac/Linux shells around arguments containing a dollar sign,
  1113. but double quotes are used instead in Windows. Also note that this technique
  1114. is slower since the implied <code>-tagsFromFile</code> adds an extra unnecessary
  1115. processing pass to read tags from the file.)
  1116. <pre>exiftool '-comment&lt;line 1$/line 2' image.jpg
  1117. </pre></li>
  1118. </ol>
  1119. </blockquote>
  1120. <a name="Q22"></a>
  1121. <p>22. <b>"In what order are command-line assignments applied when writing?"</b></p>
  1122. <blockquote>When writing, tag assignments on the command line are queued and
  1123. applied together as each target file is processed. In general, assignments
  1124. later on the command line override earlier assignments, but there are
  1125. exceptions:
  1126. <ol><li>When writing list-type tags (eg. <code>-keywords=one</code>), new values
  1127. are accumulated rather than overriding earlier assignments.<br>&nbsp;</li>
  1128. <li>When copying values to list-type tags (eg.
  1129. <code>"-keywords&lt;filename"</code>), new values are accumulated only if
  1130. <code>-addTagsFromFile</code> is used, otherwise they override earlier
  1131. assigments if <code>-tagsFromFile</code> is used or implied.<br>&nbsp;</li>
  1132. <li>Tags copied with the <code>-tagsFromFile</code> option are assigned in
  1133. order, and all together at the point in the command line where the
  1134. <code>-tagsFromFile</code> option is located, regardless of whether these tags
  1135. are specified immediately after the <code>-tagsFromFile</code> option or later
  1136. on the command line. Remember that "<code>-tagsFromFile @</code>" is implied
  1137. unless another file is specified when redirecting information with arguments
  1138. like <code>"-DSTTAG&lt;SRCTAG"</code>.</li></ol> Note: When copying tag values,
  1139. adding to lists, or shifting date/time values, the source value is always the
  1140. original value found in the file, regardless of any previous assignments. For
  1141. example, the following command sets Subject to the original value of Title in
  1142. the file (NOT to "test"):
  1143. <pre>exiftool -title=test "-subject&lt;title" a.jpg</pre></blockquote>
  1144. <a name="Q23"></a>
  1145. <p>23a. <b>"Why do I get '<code>0 image files updated</code>' when writing?"</b>, or<br>
  1146. 23b. <b>"ExifTool doesn't write some tags to a file"</b></p>
  1147. <blockquote>There are a few reasons why this may happen:
  1148. <ol><li>The value of the tag is not being set correctly.</li></ol>
  1149. This may be due to a tag value which can't be converted, in which case you
  1150. should warning like this (note: you may need to use the <code>-v3</code> option
  1151. to see the warning if other same-named tags are being set properly by the same
  1152. assignment):
  1153. <pre>Warning: Can't convert IFD0:Orientation (not in PrintConv)
  1154. </pre>
  1155. You get this warning if you write an invalid value to a tag which accepts only
  1156. specific values. See the "Values" column in the appropriate table of the
  1157. <a href="TagNames/index.html">tag name documentation</a> for a list of valid
  1158. values for these types of tags. The value conversion may also be bypassed with
  1159. the <code>-n</code> option, allowing numerical values to be written directly.
  1160. See <a href="#Q6">FAQ number 6</a> for more details.
  1161. <ol start="2"><li>The information type isn't supported by the format of the
  1162. target file.</li></ol>
  1163. Warnings are NOT generated when a tag isn't written because it is
  1164. normal that many tags can't be written when copying between files of different
  1165. formats.</blockquote>
  1166. <blockquote>Tags are not written if the format of the target file doesn't
  1167. support the specific type of meta information. For example, CRW images do not
  1168. support EXIF or IPTC metdata. See the
  1169. <a href="index.html#supported">Supported File Types</a> table for an indication
  1170. of the tags supported by your file. If the tags aren't supported for your file
  1171. type, then a <a href='metafiles.html'>metadata sidecar file</a> is an
  1172. alternative.</blockquote>
  1173. <blockquote>Also note that MakerNotes tags can not be created or deleted
  1174. individually, so they can only be written if they already exist in a
  1175. file. The entire MakerNotes must be created or deleted as a block (see
  1176. <a href="#Q8">FAQ number 8</a> for details).
  1177. <ol start="3"><li>A time value is being shifted but the specified tag doesn't
  1178. exist.</li></ol>
  1179. For example, <code>-datetimeoriginal+=1</code> will have no effect unless
  1180. the DateTimeOriginal tag exists in the image.</blockquote>
  1181. <a name="Q24"></a>
  1182. <p>24. <b>"When I write a file the date/time gets reset to today's date"</b></p>
  1183. <blockquote>There is sometimes confusion between date/time values stored in the
  1184. metadata of the file itself and date/time values stored in the filesystem (ie.
  1185. in the disk directory information). A command like this may be used to extract
  1186. all date/time information with an indication of where it is stored:
  1187. <pre>exiftool -time:all -a -G0:1 -s c:\images\test.jpg</pre>
  1188. and should give an output something like this:
  1189. <pre>[File:System] FileModifyDate : 2009:10:05 20:40:36-04:00
  1190. [File:System] FileAccessDate : 2009:10:07 09:22:12-04:00
  1191. [File:System] FileCreateDate : 2009:10:05 20:40:36-04:00
  1192. [EXIF:IFD0] ModifyDate : 2003:10:31 15:44:19
  1193. [EXIF:ExifIFD] DateTimeOriginal : 2003:10:31 15:44:19
  1194. [EXIF:ExifIFD] CreateDate : 2003:10:31 15:44:19</pre>
  1195. The <code>-G0:1</code> option causes the family 0 and 1 group names to be
  1196. reported in square brackets for each tag. Tags labelled "File:System" are
  1197. "pseudo" tags stored in the filesystem, while the others are "real" tags stored
  1198. in the metadata of the file.</blockquote>
  1199. <blockquote>ExifTool's <b>default behaviour is to set all filesystem times to
  1200. the current date/time when any "real" tag is written</b>, but the
  1201. <code>-P</code> option may be used to preserve the original FileModifyDate.
  1202. FileAccessDate represents the time the file was last accessed, and is set to the
  1203. current date/time whenever any software (including ExifTool) accesses the
  1204. file.</blockquote>
  1205. <blockquote>On systems where a filesystem creation date is maintained, ExifTool
  1206. also sets this to the current date/time when the file is edited. On Windows the
  1207. creation date is accessed through the FileCreateDate tag, and is also preserved
  1208. with the <code>-P</code> option. On Mac/Linux FileInodeChangeDate is available
  1209. instead of FileCreateDate, and the only way to preserve the file creation date
  1210. is with the <code>-overwrite_original_in_place</code> option.</blockquote>
  1211. <blockquote>For example, commands like this act on common metadata tags, setting
  1212. the filesystem modification date/time to the current date/time:
  1213. <pre><span class='blk'># common metadata date/time tags are incremented by 1 hour, while
  1214. # FileModifyDate is set to the current date/time</span>
  1215. exiftool -alldates+=1 c:\images</pre>
  1216. <i class=lt>[The AllDates tag is a shortcut which represents the 3 common
  1217. metadata date/time tags: DateTimeOriginal, CreateDate and
  1218. ModifyDate.]</i></blockquote>
  1219. <blockquote>However, FileModifyDate may be preserved with the <code>-P</code>
  1220. option:
  1221. <pre><span class='blk'># FileModifyDate is not changed</span>
  1222. exiftool -alldates+=1 -P c:\images</pre>
  1223. ExifTool also allows FileModifyDate to be written, which provides full control
  1224. over the filesystem modification date/time when writing:
  1225. <pre><span class='blk'># FileModifyDate is incremented by 1 hour</span>
  1226. exiftool -alldates+=1 -filemodifydate+=1 c:\images
  1227. <span class='blk'># FileModifyDate is set from the value of DateTimeOriginal
  1228. # (before DateTimeOriginal is incremented by 1 hour)</span>
  1229. exiftool -alldates+=1 "-filemodifydate&lt;datetimeoriginal" c:\images
  1230. </pre></blockquote>
  1231. <a name="Q25"></a>
  1232. <p>25. <b>"Can ExifTool be used as an image validator?"</b></p>
  1233. <blockquote>ExifTool is <u>not</u> designed as an image validator. It does issue
  1234. warnings about some of the more important problems in the metadata when
  1235. reading, and will often catch more problems when writing, but it does not
  1236. attempt to do a full validation. If you are looking for a validator,
  1237. try <a href="http://jhove.sourceforge.net">JHOVE</a>.</blockquote>
  1238. <a name="Q26"></a>
  1239. <p>26. <b>"How do I import information from a database?"</b></p>
  1240. <blockquote><i>[See <a href="#Q12">FAQ number 12</a> for help with the reverse
  1241. -- exporting metadata to a database.]</i></blockquote>
  1242. <blockquote>ExifTool has the ability to import metadata from CSV and JSON format
  1243. database files for writing to output image files. For example, the following
  1244. commands use imported metadata to write to all image files in a directory.
  1245. <pre><span class='blk'># import from CSV file</span>
  1246. exiftool -csv="c:\Users\Phil\test.csv" "c:\Users\Phil\Images"
  1247. <span class='blk'># import from JSON file</span>
  1248. exiftool -json="c:\Users\Phil\test.json" "c:\Users\Phil\Images"</pre>
  1249. For the above commands, the input CSV or JSON file must have the same format as
  1250. the output from these commands:
  1251. <pre><span class='blk'># export to CSV file</span>
  1252. exiftool -csv "c:\Users\Phil\Images" > "c:\Users\Phil\test.csv"
  1253. <span class='blk'># export to JSON file</span>
  1254. exiftool -json "c:\Users\Phil\Images" > "c:\Users\Phil\test.json"</pre>
  1255. Specifically, the first row of the CSV file must contain the tag names.
  1256. The first column must be a special "SourceFile" column, containing the names of
  1257. the associated image files, with paths specified in the same way as on the
  1258. command line. The JSON file contains similar entries, but is not structured in
  1259. row/column format.</blockquote>
  1260. <blockquote>For each image file specified on the command line, all tags for the
  1261. database entry with the corresponding SourceFile name are written (with the
  1262. exception of the FileName and Directory tags, which are ignored). A special
  1263. SourceFile name of "*" may be used to match any image file. A warning is issued
  1264. and nothing is written if a specified file does not match any SourceFile entry
  1265. in the database.</blockquote>
  1266. <blockquote>Tag names may be prefixed by a group name to write to a specific
  1267. group (using the same format as when <code>-G</code> or <code>-G1</code> is
  1268. added to the export command). Tags with empty values are ignored. To delete a
  1269. tag, set the tag value to "-" and use the <code>-f</code> option when
  1270. importing.</blockquote>
  1271. <blockquote>See the <code>-csv</code> or <code>-j</code> option in the
  1272. <a href="exiftool_pod.html#input_output_text_formatting">application documentation</a>
  1273. for more details.</blockquote>
  1274. <hr>
  1275. <i>Last revised Jan. 12, 2015</i>
  1276. <p class='lf'><a href="index.html">&lt;-- Back to ExifTool home page</a></p>
  1277. </body>
  1278. </html>