| 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 & 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 and image quality</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 |
<li><a href="#Q27">Windows .BAT file problems</a></li> |
| 46 |
<li><a href="#Q28">Copying a shifted date/time</a></li> |
| 47 |
<li><a href="#Q29">ARGFILE options</a></li> |
| 48 |
<li><a href="#Q30">Extracting all metadata</a></li> |
| 49 |
<li><a href="#Q31">Rewriting the entire file</a></li> |
| 50 |
<li><a href="#Q32">Safely removing all metadata</a></li> |
| 51 |
<li><a href="#Q33">No writable tags set from <file></a></li> |
| 52 |
</ol> |
| 53 |
</div> |
| 54 |
|
| 55 |
<h1 class='up'>ExifTool FAQ</h1> |
| 56 |
|
| 57 |
<a name="Q1"></a> |
| 58 |
<p>1. <b>"Is there a forum for discussing ExifTool issues?"</b></p> |
| 59 |
|
| 60 |
<blockquote> |
| 61 |
ExifTool issues can be discussed on the ExifTool forum at |
| 62 |
<a href="https://exiftool.org/forum/">https://exiftool.org/forum/</a> |
| 63 |
</blockquote> |
| 64 |
|
| 65 |
<a name="Q2"></a> |
| 66 |
<p>2. <b>"How do I determine the tag name for some information?"</b></p> |
| 67 |
|
| 68 |
<blockquote>When you run exiftool, by default it prints descriptions, not tag |
| 69 |
names, for the information it extracts. These descriptions are in English |
| 70 |
unless the <code>-lang</code> option is used to select another language. Note |
| 71 |
that descriptions often contain spaces between words, but tag names never do. |
| 72 |
Also, tag names are always English, regardless of the <code>-lang</code> |
| 73 |
setting. To print the tag names instead instead of descriptions, use the |
| 74 |
<code>-s</code> option when extracting information. eg) |
| 75 |
<pre>exiftool -s image.jpg</pre> |
| 76 |
Valid characters in tag names are <code>A-Z</code>, <code>a-z</code>, |
| 77 |
<code>0-9</code>, <code>_</code> and <code>-</code>. See the |
| 78 |
<a href="TagNames/index.html">tag name documentation</a> for a complete list of |
| 79 |
available tag names.</blockquote> |
| 80 |
|
| 81 |
<blockquote>Tag names may be optionally prefixed by a group name to specify a |
| 82 |
particular information type or location. Use the <code>-g0</code>, |
| 83 |
<code>-g1</code>, etc (or <code>-G0</code>, <code>-G1</code>, etc) options when |
| 84 |
extracting information to see the corresponding group names. See the <a |
| 85 |
href="index.html#groups">Tag Groups</a> section of the ExifTool home page for |
| 86 |
more information. </blockquote> |
| 87 |
|
| 88 |
<a name="Q3"></a> |
| 89 |
<p>3a. <b>"ExifTool reports the wrong value or doesn't extract a tag"</b>, |
| 90 |
<br>3b. <b>"ExifTool doesn't write a tag properly"</b>, or |
| 91 |
<br>3c. <b>"Other software can't read information written by ExifTool"</b></p> |
| 92 |
|
| 93 |
<blockquote><i>[Also see <a href="#Q23">FAQ number 23</a> for reasons why |
| 94 |
ExifTool may not write some tags to certain file types.]</i></blockquote> |
| 95 |
|
| 96 |
<blockquote>First, if ExifTool says "image files updated", then some information |
| 97 |
was written. Make sure you are looking at the right information. Use ExifTool |
| 98 |
with a command like this to extract all information from the file, along with |
| 99 |
the location it was written: |
| 100 |
|
| 101 |
<pre>exiftool -a -G1 -s c:\images\test.jpg</pre> |
| 102 |
|
| 103 |
In this command, <code>-a</code> allows duplicate tags to be extracted, |
| 104 |
<code>-G1</code> shows the family 1 group name (ie. the location) of each tag, |
| 105 |
and <code>-s</code> shows the tag names instead of their descriptions. |
| 106 |
(Substitute the path name of your file in place of |
| 107 |
"<code>c:\images\test.jpg</code>".)</blockquote> |
| 108 |
|
| 109 |
<blockquote>When duplicate tags exist, only one is extracted unless the |
| 110 |
<code>-a</code> option is used. Beware that options like <code>-EXIF:all</code> |
| 111 |
select all EXIF tags from the extracted tags, so EXIF tags hidden by duplicate |
| 112 |
tags in other locations will not appear in the output for |
| 113 |
<code>-EXIF:all</code>. For example, the command |
| 114 |
|
| 115 |
<pre>exiftool -gps:all image.jpg</pre> |
| 116 |
|
| 117 |
will NOT necessarily extract all EXIF GPS tags because some may have been |
| 118 |
suppressed by same-named tags in other groups. To be sure all EXIF GPS tags are |
| 119 |
extracted, the <code>-a</code> option must be used: |
| 120 |
|
| 121 |
<pre>exiftool -a -gps:all image.jpg</pre> |
| 122 |
|
| 123 |
<i class=lt>[But note that GPS information may be stored in metadata formats |
| 124 |
other than just EXIF, so restricting the command to the EXIF "GPS" group may |
| 125 |
miss GPS information in other formats. The following command is better suited |
| 126 |
to extract all GPS from a wide variety of file formats:]</i> |
| 127 |
|
| 128 |
<pre>exiftool -a "-gps*" -ee video.mp4</pre> |
| 129 |
|
| 130 |
If you are having problems with other software reading information written by |
| 131 |
ExifTool, if possible try first writing the information from the other software, |
| 132 |
then use ExifTool (with the <code>-a</code> and <code>-G1</code> options) to |
| 133 |
determine where the information was written. Once you know where it should go, |
| 134 |
you can use ExifTool to write to this location. You can read or write |
| 135 |
information in a specific location by prefixing the tag name on the command line |
| 136 |
with the desired group name. eg.) "<code>-ExifIFD:DateTimeOriginal</code>" |
| 137 |
</blockquote> |
| 138 |
|
| 139 |
<blockquote>This problem may also occur if contradictory information exists in |
| 140 |
different meta information formats within the same file. For example, often XMP |
| 141 |
will be ignored if IPTC exists and the Photoshop:IPTCDigest does not agree with |
| 142 |
the IPTC content. The |
| 143 |
<a href="https://web.archive.org/web/20181006115950/http://www.metadataworkinggroup.org/specs/">Metadata Working Group</a> |
| 144 |
recommends techniques to keep the EXIF, IPTC and XMP metadata synchronized. |
| 145 |
These recommendations are implemented by the ExifTool |
| 146 |
<a href="TagNames/MWG.html">MWG tags</a>. For maximum compatibility with the |
| 147 |
widest range of applications, it is suggested that these MWG tags be used |
| 148 |
whenever possible.</blockquote> |
| 149 |
|
| 150 |
<blockquote>One final note: When writing, the <code>-v2</code> option may be |
| 151 |
useful because it provides details about what ExifTool is writing, and where. |
| 152 |
</blockquote> |
| 153 |
|
| 154 |
<a name="Q4"></a> |
| 155 |
<p>4. <b>"ExifTool reports more than one shutter speed or aperture value, and |
| 156 |
they are slightly different"</b></p> |
| 157 |
|
| 158 |
<blockquote> |
| 159 |
There are a number of different ways that aperture and shutter speed information |
| 160 |
are stored in many images. The standard EXIF values (EXIF:FNumber and |
| 161 |
EXIF:ExposureTime) should correspond to the values displayed by your camera, but |
| 162 |
these values may have been rounded off by the camera and/or ExifTool. (You can |
| 163 |
use the <code>-n</code> option to avoid rounding by ExifTool and show the full |
| 164 |
value in decimal form.) The corresponding EXIF APEX values (EXIF:ApertureValue |
| 165 |
and EXIF:ShutterSpeedValue) may be different due to their own round-off errors. |
| 166 |
If available, the MakerNotes values may be the most accurate because they |
| 167 |
haven't been rounded off to nice even values for display, so with these you may |
| 168 |
see odd values like 1/102 instead of 1/100, etc. |
| 169 |
</blockquote> |
| 170 |
|
| 171 |
<a name="Q5"></a> |
| 172 |
<p>5. <b>"How do I format date and time information for writing?"</b></p> |
| 173 |
|
| 174 |
<blockquote>All information (including date/time information) is written in the |
| 175 |
same format as it is read out. When reading, ExifTool converts all date and |
| 176 |
time information to standard EXIF format, so this is also the way it is |
| 177 |
specified when writing. The standard EXIF date/time format is |
| 178 |
"<code>YYYY:mm:dd HH:MM:SS</code>", and some meta information formats such as |
| 179 |
XMP also allow sub-seconds and a timezone to be specified. The timezone format |
| 180 |
is "<code>+HH:MM</code>", "<code>-HH:MM</code>" or "<code>Z</code>". For |
| 181 |
example: |
| 182 |
|
| 183 |
<pre>exiftool -xmp:dateTimeOriginal="2005:10:23 20:06:34.33-05:00" a.jpg |
| 184 |
</pre> |
| 185 |
|
| 186 |
When writing XMP or other information types which allow incomplete date/time |
| 187 |
values, the following input formats are also accepted: |
| 188 |
|
| 189 |
<pre>YYYY |
| 190 |
YYYY:mm |
| 191 |
YYYY:mm:dd |
| 192 |
YYYY:mm:dd HH:MM |
| 193 |
</pre> |
| 194 |
|
| 195 |
Having said this, ExifTool is very flexible about the actual format of input |
| 196 |
date/time values when writing, and will attempt to reformat any values into the |
| 197 |
standard format unless the <code>-n</code> option is used. Any separators may |
| 198 |
be used (or in fact, none at all). The first 4 consecutive digits found in the |
| 199 |
value are interpreted as the year, then next 2 digits are the month, and so on. |
| 200 |
<i class=lt>[The year must be 4 digits. Other fields are expected to be 2 |
| 201 |
digits, but a single digit is allowed if the subsequent character is a |
| 202 |
non-digit.]</i> For EXIF date/time values, all 6 date/time fields must exist |
| 203 |
("<code>YYYYmmddHHMMSS</code>"), but XMP date/time values require only the year |
| 204 |
("<code>YYYY</code>"). This feature facilitates useful operations such as |
| 205 |
setting date/time tags from a date embedded in the file name. For example, the |
| 206 |
command |
| 207 |
|
| 208 |
<pre>exiftool "-alldates<filename" c:\images</pre> |
| 209 |
|
| 210 |
will set the common date/time tags from the file name for all images in the |
| 211 |
directory "<code>c:\images</code>". This will work for any file name which |
| 212 |
matches the above criteria (eg. "IMG_20110927_103000.jpg"). |
| 213 |
<i class=lt>[AllDates is a shortcut for 3 tag names: DateTimeOriginal, |
| 214 |
CreateDate and ModifyDate. See the <a href="TagNames/Shortcuts.html">Shortcuts |
| 215 |
Tags documentation</a> for more information.]</i></blockquote> |
| 216 |
|
| 217 |
<blockquote>The <code>-d</code> option provides additional flexibility in |
| 218 |
parsing strings when writing date/time tags with ExifTool 10.32 or later if |
| 219 |
POSIX::strptime or Time::Piece is installed (use "<code>exiftool -ver -v</code>" |
| 220 |
to check the installed packages). The format of the <code>-d</code> argument is |
| 221 |
the same for reading and writing.</blockquote> |
| 222 |
|
| 223 |
<blockquote>The <code>-n</code> option may be used to disable all of the |
| 224 |
date/time reformatting when reading and writing which will allow otherwise |
| 225 |
invalid date/time values to be written (eg. partial EXIF dates). The |
| 226 |
reformatting may be disabled on a per-tag basis by adding "<code>#</code>" |
| 227 |
to the tag name instead of using <code>-n</code></blockquote> |
| 228 |
|
| 229 |
<blockquote><b>Special feature</b>: A value of "<code>now</code>" may be used to |
| 230 |
represent the current time when writing any date/time tag. For example: |
| 231 |
<pre>exiftool -xmp:dateTimeOriginal=now a.jpg</pre> |
| 232 |
<i class=lt>[There is also a <a href="TagNames/Extra.html">Now tag</a> which may |
| 233 |
be used for a similar purpose by copying its value to another tag, but copying |
| 234 |
tags adds an extra read stage to the processing which is best avoided if |
| 235 |
performance is an issue.]</i> |
| 236 |
</blockquote> |
| 237 |
|
| 238 |
<a name="Q6"></a> |
| 239 |
<p>6. <b>"I get '<code>Can't convert TAG (not in PrintConv)</code>' errors when |
| 240 |
writing a tag"</b></p> |
| 241 |
|
| 242 |
<blockquote> |
| 243 |
By default, ExifTool applies a print conversion (PrintConv) to extracted |
| 244 |
information to make the output more human-readable. Some conversions involve |
| 245 |
lookup tables which are documented in the <b>Values</b> column of the |
| 246 |
<a href="TagNames/index.html">tag name documentation</a>. For example, the |
| 247 |
GPSAltitudeRef tag defines the following conversions: |
| 248 |
<pre>0 = Above Sea Level |
| 249 |
1 = Below Sea Level |
| 250 |
</pre> |
| 251 |
For this tag, a value of '0' is printed as 'Above Sea Level', and '1' is printed |
| 252 |
as 'Below Sea Level'. Reading and writing with ExifTool is symmetrical <i>[with |
| 253 |
the possible exception of list-type tags -- see <a href="#Q17">FAQ number 17</a> |
| 254 |
below]</i>, so a value that is printed as 'Above Sea Level' must also be written in |
| 255 |
that form. (In other words, the inverse print conversion is applied when writing |
| 256 |
values.) For example, to write GPSAltitudeRef you can type: |
| 257 |
<pre>exiftool -gpsaltituderef="Above Sea Level" image.jpg |
| 258 |
</pre> |
| 259 |
or any unambiguous short form may be used and ExifTool will know what you mean, eg) |
| 260 |
<pre>exiftool -gpsaltituderef=above image.jpg |
| 261 |
</pre> |
| 262 |
Alternatively, the print conversion can be disabled for all tags with the |
| 263 |
<code>-n</code> option, or for individual tags by suffixing the tag name with a |
| 264 |
'<code>#</code>' character. In either case the printed value of GPSAltitudeRef |
| 265 |
will be '0' or '1' when extracting information, and the value is written in the |
| 266 |
same way. So following two commands have exactly the same effect as above: |
| 267 |
<pre>exiftool -gpsaltituderef=0 -n image.jpg |
| 268 |
exiftool -gpsaltituderef#=0 image.jpg |
| 269 |
</pre> |
| 270 |
Integer values may also be specified in hexadecimal (with a leading '0x'). For |
| 271 |
example, the following commands are all equivalent: |
| 272 |
<pre>exiftool -flash=1 -n image.jpg |
| 273 |
exiftool -flash=0x1 -n image.jpg |
| 274 |
exiftool -flash#=1 image.jpg |
| 275 |
exiftool -flash#=0x1 image.jpg |
| 276 |
exiftool -flash=fired image.jpg |
| 277 |
</pre></blockquote><blockquote class=prog> |
| 278 |
<b>Programmers</b>: These techniques look like this when calling Image::ExifTool |
| 279 |
functions from a Perl script: |
| 280 |
<pre>$exifTool->SetNewValue(flash => 1, Type => 'ValueConv'); |
| 281 |
$exifTool->SetNewValue(flash => 0x1, Type => 'ValueConv'); |
| 282 |
$exifTool->SetNewValue('flash#' => 1); |
| 283 |
$exifTool->SetNewValue('flash#' => 0x1); |
| 284 |
$exifTool->SetNewValue(flash => 'fired'); |
| 285 |
</pre></blockquote> |
| 286 |
|
| 287 |
<a name="Q7"></a> |
| 288 |
<p>7. <b>"I can't delete all EXIF information from a TIFF file using |
| 289 |
'<code>exiftool -exif:all= img.tif</code>'"</b></p> |
| 290 |
|
| 291 |
<blockquote>This is because of the way a TIFF file is structured. With a JPEG |
| 292 |
image, this command removes IFD0 (the main Image File Directory) as well as any |
| 293 |
subdirectories, thus removing all EXIF information. But with the TIFF format, |
| 294 |
the main image itself is stored in IFD0, so deleting this directory would |
| 295 |
destroy the image. The same is true for any TIFF-based RAW file such as DNG, |
| 296 |
CR2, NEF, etc. For these types of files, ExifTool just deletes the ExifIFD |
| 297 |
subdirectory, so any information stored in other directories is preserved (BUT |
| 298 |
NOTE THAT WITH PROPRIETARY RAW FORMATS THIS MAY DELETE INFORMATION THAT IS |
| 299 |
NECESSARY FOR PROPER RENDERING OF THE IMAGE). |
| 300 |
</blockquote> |
| 301 |
|
| 302 |
<blockquote>Use "<code>exiftool -a -G1 -s img.tif</code>" to see where the |
| 303 |
information is stored. Any tags remaining in other IFD's must be deleted |
| 304 |
individually from a TIFF-format file if desired. For convenience, a CommonIFD0 |
| 305 |
<a href="TagNames/Shortcuts.html">shortcut tag</a> is provided to simplify the |
| 306 |
deletion of common metadata tags from IFD0 by adding "<code>-CommonIFD0=</code>" |
| 307 |
to the command line. |
| 308 |
</blockquote> |
| 309 |
|
| 310 |
<a name="Q8"></a> |
| 311 |
<p>8a. <b>"All maker note information is lost if I change the Make or Model tag"</b>, or |
| 312 |
<br>8b. <b>"I can't copy maker note information to an image"</b>, or |
| 313 |
<br>8c. <b>"I can't view a RAW image after changing the model tag"</b></p> |
| 314 |
|
| 315 |
<blockquote> |
| 316 |
The Make and Model tags are used by some image utilities (including ExifTool) to |
| 317 |
determine the format of the maker note information. Deleting or changing either |
| 318 |
of these tags may prevent these utilities from recognizing or properly |
| 319 |
interpreting the maker notes (which, for a RAW image, may mean that the image |
| 320 |
can no longer be properly rendered). Also beware that the maker notes |
| 321 |
information may be damaged if an image is edited when the maker notes are not |
| 322 |
properly recognized. So it is a good idea not to edit the Make and Model tags in |
| 323 |
the first place.</blockquote> |
| 324 |
|
| 325 |
<blockquote>If you really want to delete the Make and Model information, you |
| 326 |
might as well delete the maker notes too. You can do this with either of the |
| 327 |
following commands: |
| 328 |
<pre>exiftool -make= -model= -makernotes:all= image.jpg |
| 329 |
exiftool -make= -model= -makernotes= image.jpg |
| 330 |
</pre> |
| 331 |
For the same reason, maker notes can not be copied to an image with an |
| 332 |
incompatible Make or Model. To do this, the Make and Model tags must also be |
| 333 |
copied. eg) |
| 334 |
<pre>exiftool -tagsfromfile src.jpg -makernotes -make -model dst.jpg |
| 335 |
</pre> |
| 336 |
(Note that in this case the "<code>-makernotes:all</code>" syntax does not work |
| 337 |
because it attempts to copy the maker note tags individually. Since maker note |
| 338 |
tags may not be created individually, they must instead be copied as a block |
| 339 |
with "<code>-makernotes</code>".) |
| 340 |
</blockquote> |
| 341 |
|
| 342 |
<a name="Q9"></a> |
| 343 |
<p>9a. <b>"The information is different when I copy all tags to a new file"</b>, or |
| 344 |
<br>9b. <b>"The tag locations change when I use <code>-tagsfromfile</code> |
| 345 |
to copy information"</b></p> |
| 346 |
|
| 347 |
<blockquote> |
| 348 |
This feature is explained under the <code>-tagsFromFile</code> option in |
| 349 |
the <a href="exiftool_pod.html">exiftool application documentation</a>, but the |
| 350 |
question is common enough that it is discussed here in more detail.</blockquote> |
| 351 |
|
| 352 |
<blockquote>By default, ExifTool will store information in preferred locations |
| 353 |
when either writing new information or copying information between files. This |
| 354 |
freedom allows ExifTool to write or copy information to files of different |
| 355 |
formats without requiring the user to know details about where the information |
| 356 |
is stored.</blockquote> |
| 357 |
|
| 358 |
<blockquote>The preferred general locations for information written to JPEG |
| 359 |
images are 1) EXIF, 2) IPTC and 3) XMP. As an example, information extracted |
| 360 |
from the maker notes will be preferentially written (on a tag-by-tag basis) in |
| 361 |
EXIF format when copying information between two JPEG images. But if a specific |
| 362 |
tag doesn't exist in EXIF, then the tag is written to the first valid group in |
| 363 |
the order specified above. The advantage of "translating" the information to |
| 364 |
EXIF is that it then becomes readable by applications which only support |
| 365 |
standard EXIF. The disadvantage is that you don't get an exact copy of the |
| 366 |
original information structure.</blockquote> |
| 367 |
|
| 368 |
<blockquote>But ExifTool gives you the ability to customize this behaviour to |
| 369 |
write the information to wherever you want. This is done by specifying a group |
| 370 |
name for the tag(s) to be copied. This applies even if the group name is |
| 371 |
"<code>all</code>", in which case the original family 1 group is preserved. So |
| 372 |
to copy all information and preserve the original structure, use this syntax: |
| 373 |
|
| 374 |
<pre>exiftool -tagsfromfile src.jpg -all:all dst.jpg |
| 375 |
</pre> |
| 376 |
|
| 377 |
In this command, since no destination tag was specified, the destination is the |
| 378 |
same as the source (ie. "<code>-all:all>all:all</code>"), so the information is |
| 379 |
copied to the same family 1 group.</blockquote> |
| 380 |
|
| 381 |
<blockquote>Here are some examples to show you the type of control you have over |
| 382 |
where the information is written. All commands in each example are equivalent: |
| 383 |
|
| 384 |
<pre><span class='blk'># copy all tags to preferred groups (no destination group)</span> |
| 385 |
exiftool -tagsfromfile src.jpg dst.jpg |
| 386 |
exiftool -tagsfromfile src.jpg -all dst.jpg |
| 387 |
exiftool -tagsfromfile src.jpg "-all>all" dst.jpg |
| 388 |
exiftool -tagsfromfile src.jpg "-all:all>all" dst.jpg |
| 389 |
|
| 390 |
<span class='blk'># copy all tags, preserving family 1 group (destination group 'all')</span> |
| 391 |
exiftool -tagsfromfile src.jpg -all:all dst.jpg |
| 392 |
exiftool -tagsfromfile src.jpg "-all>all:all" dst.jpg |
| 393 |
exiftool -tagsfromfile src.jpg "-all:all>all:all" dst.jpg |
| 394 |
|
| 395 |
<span class='blk'># copy all tags to EXIF group (destination group 'exif') |
| 396 |
# [the destination family 1 group is the preferred EXIF IFD]</span> |
| 397 |
exiftool -tagsfromfile src.jpg "-all>exif:all" dst.jpg |
| 398 |
exiftool -tagsfromfile src.jpg "-all:all>exif:all" dst.jpg |
| 399 |
|
| 400 |
<span class='blk'># copy XMP tags to XMP group (destination group 'xmp') |
| 401 |
# [the destination family 1 group is the preferred XMP namespace]</span> |
| 402 |
exiftool -tagsfromfile src.jpg "-xmp:all" dst.jpg |
| 403 |
exiftool -tagsfromfile src.jpg "-xmp:all>xmp:all" dst.jpg |
| 404 |
|
| 405 |
<span class='blk'># copy XMP tags, preserving family 1 group (destination group 'all')</span> |
| 406 |
exiftool -tagsfromfile src.jpg "-xmp:all>all:all" dst.jpg |
| 407 |
|
| 408 |
<span class='blk'># copy XMP tags to preferred groups (no destination group)</span> |
| 409 |
exiftool -tagsfromfile src.jpg "-xmp:all>all" dst.jpg |
| 410 |
|
| 411 |
<span class='blk'># copy XMP tags to EXIF only (destination group 'exif') |
| 412 |
# [the destination family 1 group is the preferred EXIF IFD]</span> |
| 413 |
exiftool -tagsfromfile src.jpg "-xmp:all>exif:all" dst.jpg |
| 414 |
</pre> |
| 415 |
|
| 416 |
The same rules illustrated above also apply when copying individual tags.</blockquote> |
| 417 |
|
| 418 |
<blockquote>Note: If no destination group is specified, a new tag is created if |
| 419 |
necessary only in the preferred group, but if the same tag already exists in |
| 420 |
another group, then this information is also updated. (Otherwise inconsistent |
| 421 |
values for the same information would exist in different locations. Of course, |
| 422 |
you can always generate inconsistencies like this if you really want to by |
| 423 |
specifically writing contradictory information to different groups.) |
| 424 |
</blockquote> |
| 425 |
|
| 426 |
<blockquote>Certain types of meta information (such as EXIF, IPTC, XMP and |
| 427 |
ICC_Profile) may also be <b>copied as a block</b>. This technique copies all |
| 428 |
meta information, even if ExifTool doesn't have the ability to write some |
| 429 |
individual tags contained in the block. For all block types except EXIF, the |
| 430 |
metadata is copied byte-for-byte from the original image. With EXIF however, |
| 431 |
the metadata may be restructured to ensure that it is self-contained. Also note |
| 432 |
that EXIF may not be written as a block to TIFF-based file formats. Beware that |
| 433 |
<b>any existing metadata</b> of this type in the destination file <b>will be |
| 434 |
overwritten</b> by the new block. |
| 435 |
|
| 436 |
<pre><span class='blk'># copy EXIF as a block between same-named JPG files in different directories</span> |
| 437 |
exiftool -tagsfromfile SRCDIR/%f.%e -exif -ext jpg DSTDIR |
| 438 |
|
| 439 |
<span class='blk'># copy XMP as a block from one file to another</span> |
| 440 |
exiftool -tagsfromfile src.jpg -xmp dst.cr2 |
| 441 |
</pre></blockquote> |
| 442 |
|
| 443 |
<a name="Q10"></a> |
| 444 |
<p>10. <b>"How does ExifTool handle coded character sets?"</b></p> |
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
<blockquote><i>[Also see <a href="#Q18">FAQ number 18</a> for help with |
| 450 |
special characters in a Windows console.]</i></blockquote> |
| 451 |
|
| 452 |
<blockquote>Certain meta information formats allow coded character sets other |
| 453 |
than plain ASCII. When reading, most known encodings are converted to the |
| 454 |
external character set according to the exiftool "<code>-charset CHARSET</code>" |
| 455 |
or <code>-L</code> option, or to UTF‑8 by default. When writing, the |
| 456 |
inverse conversion is performed. Alternatively, special characters may be |
| 457 |
converted to/from HTML character entities with the <code>-E</code> option. |
| 458 |
</blockquote> |
| 459 |
|
| 460 |
<blockquote>A distinction is made between the <b>external</b> character set |
| 461 |
visible to the ExifTool user, and the <b>internal</b> character used to store |
| 462 |
text in the metadata of a file. These character sets may be specified |
| 463 |
separately as follows: |
| 464 |
<ol><li>The <b>external</b> character set for <b>tag values</b> passed to/from |
| 465 |
ExifTool is UTF‑8 by default, but it may be changed through any of these |
| 466 |
command-line options: |
| 467 |
<blockquote><code>-charset CHARSET</code> or |
| 468 |
<code>-charset exiftool=CHARSET</code> or <code>-L</code> |
| 469 |
</blockquote> |
| 470 |
The encoding of <b>file and directory names</b> (eg. the <i>FILE</i> argument on |
| 471 |
the command line) is different. By default, these names are passed straight |
| 472 |
through to the standard C I/O routines without recoding. On Mac/Linux these |
| 473 |
routines expect UTF‑8, but on Windows they use the system code page (which |
| 474 |
is dependent on your system settings). However, as of ExifTool 9.79, the |
| 475 |
external filename encoding may be specified: |
| 476 |
<blockquote><code>-charset filename=CHARSET</code></blockquote> |
| 477 |
When this is done, file and directory names are converted from the specified |
| 478 |
encoding to one appropriate for system I/O routines. In Windows, this also has |
| 479 |
the effect of enabling Unicode filename support via the special Windows |
| 480 |
wide-character I/O routines if the required Perl modules are available |
| 481 |
(these are included in the Windows executable version of ExifTool). See |
| 482 |
<a href="exiftool_pod.html#WINDOWS-UNICODE-FILE-NAMES">WINDOWS UNICODE FILE NAMES</a> |
| 483 |
in the application documentation for more details.<br><br></li> |
| 484 |
<li>The <b>internal</b> character set for strings stored in file metadata may be |
| 485 |
specified for some metadata types: |
| 486 |
<blockquote><code>-charset TYPE=CHARSET</code></blockquote> |
| 487 |
(where <code>TYPE</code> is "<code>exif</code>", "<code>iptc</code>", |
| 488 |
"<code>id3</code>", "<code>photoshop</code>", "<code>quicktime</code>" or |
| 489 |
"<code>riff</code>")</li></ol> |
| 490 |
|
| 491 |
Valid <code>CHARSET</code> values are (with aliases given in brackets, case is |
| 492 |
not significant): |
| 493 |
|
| 494 |
<blockquote><table class=clear> |
| 495 |
<tr><td>UTF8</td><td>(cp65001, UTF‑8)</td><td>DOSLatinUS</td><td>(cp437)</td></tr> |
| 496 |
<tr><td>Latin</td><td>(cp1252, Latin1)</td><td>DOSLatin1</td><td>(cp850)</td></tr> |
| 497 |
<tr><td>Latin2</td><td>(cp1250)</td><td>DOSCyrillic</td><td>(cp866)</td></tr> |
| 498 |
<tr><td>Cyrillic</td><td>(cp1251, Russian) </td><td>MacRoman</td><td>(cp10000, Mac, Roman)</td></tr> |
| 499 |
<tr><td>Greek</td><td>(cp1253)</td><td>MacLatin2</td><td>(cp10029)</td></tr> |
| 500 |
<tr><td>Turkish</td><td>(cp1254)</td><td>MacCyrillic</td><td>(cp10007)</td></tr> |
| 501 |
<tr><td>Hebrew</td><td>(cp1255)</td><td>MacGreek</td><td>(cp10006)</td></tr> |
| 502 |
<tr><td>Arabic</td><td>(cp1256)</td><td>MacTurkish</td><td>(cp10081)</td></tr> |
| 503 |
<tr><td>Baltic</td><td>(cp1257)</td><td>MacRomanian</td><td>(cp10010)</td></tr> |
| 504 |
<tr><td>Vietnam</td><td>(cp1258)</td><td>MacIceland</td><td>(cp10079)</td></tr> |
| 505 |
<tr><td>Thai</td><td>(cp874)</td><td>MacCroatian</td><td>(cp10082)</td></tr> |
| 506 |
</table></blockquote> |
| 507 |
|
| 508 |
The <code>-L</code> option is equivalent to "<code>-charset Latin</code>", |
| 509 |
"<code>-charset Latin1</code>" and "<code>-charset cp1252</code>".</blockquote> |
| 510 |
|
| 511 |
<blockquote>Type-specific details are given below about the special character |
| 512 |
handling for EXIF, IPTC, XMP, PNG, ID3, PDF, Photoshop, QuickTime, AIFF, RIFF, |
| 513 |
MIE and Vorbis information:</blockquote> |
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
<blockquote><a name="exif"><b>EXIF</b></a>: Most textual information in EXIF is |
| 518 |
stored in ASCII format (called "string" in the |
| 519 |
<a href="TagNames/EXIF.html">EXIF Tags documentation</a>). By default ExifTool |
| 520 |
does not convert these strings. However, it is not uncommon for applications to |
| 521 |
write UTF‑8 or other encodings where ASCII is expected. To deal with |
| 522 |
these, ExifTool allows the internal EXIF string encoding to be specified with |
| 523 |
"<code>-charset exif=CHARSET</code>", which causes EXIF string values to be |
| 524 |
converted from the specified character set when reading, and stored with this |
| 525 |
character set when writing. The |
| 526 |
<a href="http://www.metadataworkinggroup.org/">MWG</a> recommends using |
| 527 |
UTF‑8 encoding for EXIF strings, and in keeping with this the |
| 528 |
"<code>-use mwg</code>" feature sets the default internal EXIF string encoding |
| 529 |
to UTF‑8 (ie. "<code>-charset exif=utf8</code>"), but note that this will |
| 530 |
have no effect unless the external encoding is also set to something other than |
| 531 |
the default of UTF‑8.</blockquote> |
| 532 |
|
| 533 |
<blockquote>A few EXIF tags (UserComment, GPSProcessingMethod and |
| 534 |
GPSAreaInformation) support a designated internal text encoding, with values |
| 535 |
stored as ASCII, Unicode (UCS‑2) or JIS. When reading these tags, ExifTool |
| 536 |
converts Unicode and JIS to the external character set specified by the |
| 537 |
<code>-charset</code> or <code>-L</code> option, or to UTF‑8 by default. |
| 538 |
ASCII text is not converted. When writing, text is stored as ASCII unless the |
| 539 |
string contains special characters, in which case it is converted from the |
| 540 |
external character set (UTF‑8 by default), and stored as Unicode. ExifTool |
| 541 |
writes Unicode in native EXIF byte ordering by default, but the byte order may |
| 542 |
be specified by setting the ExifUnicodeByteOrder tag (see the |
| 543 |
<a href="TagNames/Extra.html">Extra Tags documentation</a>).</blockquote> |
| 544 |
|
| 545 |
<blockquote>The EXIF "XP" tags (XPTitle, XPComment, etc) are always stored |
| 546 |
internally as little-endian Unicode (UCS‑2), and are read and written |
| 547 |
using the specified external character set.</blockquote> |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
<blockquote><a name="iptc"><b>IPTC</b></a><span class='sm'><sup>†</sup></span>: |
| 552 |
The value of the IPTC:CodedCharacterSet tag determines how the internal IPTC |
| 553 |
string values are interpreted. If CodedCharacterSet exists and has a value of |
| 554 |
"<code>UTF8</code>" (or "<code>ESC % G</code>") then string values are |
| 555 |
assumed to be stored as UTF‑8. Otherwise the internal IPTC encoding is |
| 556 |
assumed to be Windows Latin1 (cp1252), but this can be changed with |
| 557 |
"<code>-charset iptc=CHARSET</code>". When reading, these strings are converted |
| 558 |
to UTF‑8 by default, or to the external character set specified by the |
| 559 |
<code>-charset</code> or <code>-L</code> option. When writing, the inverse |
| 560 |
conversions are performed. No conversion is done if the internal (IPTC) and |
| 561 |
external (ExifTool) character sets are the same. Note that ISO 2022 character |
| 562 |
set shifting is not supported. Instead, a warning is issued and the string is |
| 563 |
not converted if an ISO 2022 shift code is encountered. See the |
| 564 |
<a href="http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf">IPTC IIM |
| 565 |
specification</a> for more information about IPTC character coding.</blockquote> |
| 566 |
|
| 567 |
<blockquote>ExifTool may be used to convert IPTC values to a different internal |
| 568 |
encoding. To do this, all IPTC tags must be rewritten along with the desired |
| 569 |
value of CodedCharacterSet. For example, the following command changes the |
| 570 |
internal IPTC encoding to UTF‑8 (from Windows Latin1 unless |
| 571 |
CodedCharacterSet was already "UTF8"): |
| 572 |
<pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset=utf8 a.jpg |
| 573 |
</pre>or from Windows Latin2 (cp1250) to UTF‑8: |
| 574 |
<pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset=utf8 -charset iptc=latin2 a.jpg |
| 575 |
</pre>and this command changes it back from UTF‑8 to Windows Latin1 (cp1252): |
| 576 |
<pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset= a.jpg |
| 577 |
</pre>or to Windows Latin2: |
| 578 |
<pre>exiftool -tagsfromfile @ -iptc:all -codedcharacterset= -charset iptc=latin2 a.jpg |
| 579 |
</pre>Note that unless CodedCharacterSet is UTF‑8, applications have no |
| 580 |
reliable way to determine the IPTC character encoding. For this reason, it is |
| 581 |
recommended that CodedCharacterSet be set to "<code>UTF8</code>" when creating |
| 582 |
new IPTC.</blockquote> |
| 583 |
|
| 584 |
<blockquote class='sm'><sup>†</sup> <span class=lt>Refers to the older |
| 585 |
<a href="http://www.iptc.org/site/News_Exchange_Formats/IIM/">IPTC IIM</a> format. |
| 586 |
The more recent |
| 587 |
<a href="https://iptc.org/standards/photo-metadata/iptc-standard/">IPTC |
| 588 |
Photo Metadata Standard</a> actually uses the XMP format (see below).</span> |
| 589 |
</blockquote> |
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
<blockquote><a name="xmp"><b>XMP</b></a>: Exiftool reads XMP encoded as |
| 594 |
UTF‑8, UTF‑16 or UTF‑32, and converts them all to UTF‑8 |
| 595 |
internally. Also, all XML character entity references and numeric character |
| 596 |
references are converted. When writing, ExifTool always encodes XMP as |
| 597 |
UTF‑8, converting the following 5 characters to XML character references: |
| 598 |
<code>& < > ' "</code>. By default no further conversion is |
| 599 |
performed, however the <code>-charset</code> or <code>-L</code> option may be |
| 600 |
used to convert text to/from a specified external character set when |
| 601 |
reading/writing.</blockquote> |
| 602 |
|
| 603 |
<blockquote><a name="png"><b>PNG</b></a>: |
| 604 |
<a href="TagNames/PNG.html#TextualData">PNG TextualData tags</a> are stored as |
| 605 |
tEXt, zTXt and iTXt chunks in PNG images. The tEXt and zTXt chunks use ISO |
| 606 |
8859-1 encoding, while iTXt uses UTF‑8. When reading, ExifTool converts |
| 607 |
all PNG textual data to the external character set specified by the |
| 608 |
<code>-charset</code> or <code>-L</code> option, or to UTF‑8 by default. |
| 609 |
When writing, ExifTool generates a tEXt chunk (or zTXt with the <code>-z</code> |
| 610 |
option) if the text doesn't contain special characters or if Latin encoding is |
| 611 |
specified (<code>-L</code> or <code>-charset latin</code>); otherwise an iTXt |
| 612 |
chunk is used and the text is converted from the specified external character |
| 613 |
set and stored as UTF‑8.</blockquote> |
| 614 |
|
| 615 |
<blockquote><a name="com"><b>JPEG Comment</b></a>: The encoding for the JPEG |
| 616 |
Comment (COM segment) is not specified, so ExifTool reads/writes this text |
| 617 |
without conversion.</blockquote> |
| 618 |
|
| 619 |
<blockquote><a name="id3"><b>ID3</b></a>: The ID3v1 specification officially |
| 620 |
supports only ISO 8859‑1 encoding (a subset of Windows Latin1), although |
| 621 |
some applications may incorrectly use other character sets. By default ExifTool |
| 622 |
converts ID3v1 text from Latin to the external character set specified by the |
| 623 |
<code>-charset</code> or <code>-L</code> option, or to UTF‑8 by default. |
| 624 |
However, the internal ID3v1 charset may be specified with |
| 625 |
"<code>-charset id3=CHARSET</code>". The encoding for ID3v2 information is |
| 626 |
stored in the file, so ExifTool converts ID3v2 text from this encoding to the |
| 627 |
external character set specified by <code>-charset</code> or <code>-L</code>, or |
| 628 |
to UTF‑8 by default. ExifTool does not currently write ID3 |
| 629 |
information.</blockquote> |
| 630 |
|
| 631 |
<blockquote><a name="pdf"><b>PDF</b></a>: PDF text strings are stored in either |
| 632 |
PDFDocEncoding (similar to Windows Latin1) or Unicode (UCS‑2). When |
| 633 |
reading, ExifTool converts to the external character set specified by the |
| 634 |
<code>-charset</code> or <code>-L</code> option, or to UTF‑8 by default. |
| 635 |
When writing, ExifTool encodes input text from the specified character set as |
| 636 |
Unicode only if the string contains special characters, otherwise PDFDocEncoding |
| 637 |
is used.</blockquote> |
| 638 |
|
| 639 |
<blockquote><a name="photoshop"><b>Photoshop</b></a>: Some Photoshop resource |
| 640 |
names are stored as Pascal strings with unknown encoding. By default, ExifTool |
| 641 |
assumes MacRoman encoding and converts this to UTF‑8, but the internal and |
| 642 |
external character sets may be specified with |
| 643 |
"<code>-charset Photoshop=CHARSET</code>" and "<code>-charset CHARSET</code>" |
| 644 |
respectively.</blockquote> |
| 645 |
|
| 646 |
<blockquote><a name="quicktime"><b>QuickTime</b></a>: QuickTime text strings may |
| 647 |
be stored in a variety of poorly documented formats, and ExifTool does its best |
| 648 |
to decode these according to the <code>-charset</code> option setting. For some |
| 649 |
QuickTime strings where the internal encoding is not known, ExifTool assumes a |
| 650 |
default encoding of MacRoman, but this may be changed with |
| 651 |
"<code>-charset QuickTime=CHARSET</code>". When writing, ExifTool prefers |
| 652 |
to store as UTF‑8 if possible, and converts to this from the character |
| 653 |
set specified by the <code>-charset</code> option (UTF‑8 by default).</blockquote> |
| 654 |
|
| 655 |
<blockquote><a name="aiff"><b>AIFF</b></a>: AIFF strings are assumed to be |
| 656 |
stored in MacRoman, and are converted according to the <code>-charset</code> |
| 657 |
option when reading. </blockquote> |
| 658 |
|
| 659 |
<blockquote><a name="riff"><b>RIFF</b></a>: The internal encoding of RIFF |
| 660 |
strings (eg. in AVI and WAV files) is assumed to be Latin unless otherwise |
| 661 |
specified by the RIFF CSET chunk or the "<code>-charset RIFF=CHARSET</code>" |
| 662 |
option. </blockquote> |
| 663 |
|
| 664 |
<blockquote><a name="mie"><b>MIE</b></a>: MIE strings are stored as either |
| 665 |
UTF‑8 or ISO 8859‑1. When reading, UTF‑8 strings are converted |
| 666 |
according to the <code>-charset</code> or <code>-L</code> option, and ISO |
| 667 |
8859‑1 strings are never converted. When writing, input strings are |
| 668 |
converted from the specified character set to UTF‑8. The resulting |
| 669 |
strings are stored as UTF‑8 if they contain multi-byte UTF‑8 |
| 670 |
character sequences, otherwise they are stored as ISO 8859‑1.</blockquote> |
| 671 |
|
| 672 |
<blockquote><a name="vorbis"><b>Vorbis</b></a>: Vorbis comments are stored as |
| 673 |
UTF‑8, and are converted to the character set specified by |
| 674 |
<code>-charset</code> or <code>-L</code> when reading.</blockquote> |
| 675 |
|
| 676 |
<blockquote class=prog> |
| 677 |
<b>Programmers</b>: ExifTool returns all values as byte strings of encoded |
| 678 |
characters. Perl wide characters are not used. The encoding is UTF‑8 by |
| 679 |
default, but valid UTF‑8 can not be guaranteed for all values, so the |
| 680 |
caller must validate the encoding if necessary. The encodings described above |
| 681 |
are set by the various <a href="ExifTool.html#Charset">Charset options</a> of |
| 682 |
the API. |
| 683 |
<br><br><b>Note</b>: Some settings of the system PERL_UNICODE environment |
| 684 |
variable may be incompatible with ExifTool's character handling. |
| 685 |
</blockquote> |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
<a name="Q11"></a> |
| 691 |
<p>11. <b>"My user-defined tags don't work"</b></p> |
| 692 |
|
| 693 |
<blockquote> |
| 694 |
For examples of how to add user-defined tags, see the |
| 695 |
<a href="config.html">ExifTool_config</a> file in the ExifTool distribution. |
| 696 |
It may be useful to activate this file as a test before trying to implement |
| 697 |
your own config file. To activate this file, copy it to your <b>HOME</b> |
| 698 |
directory then rename it to "<code>.ExifTool_config</code>". |
| 699 |
<blockquote class=lt><b>Note</b>: The config file must be renamed at the |
| 700 |
command line because neither the Windows nor Mac GUI allow a file name to |
| 701 |
begin with a "<code>.</code>". To do this in Windows, run "cmd.exe" and type |
| 702 |
the following (pressing <i>ENTER</i> at the end of each line): |
| 703 |
<pre>cd %HOMEPATH% |
| 704 |
rename ExifTool_config .ExifTool_config |
| 705 |
</pre> |
| 706 |
or on a Mac, open the "Terminal" application (from the /Applications/Utilities |
| 707 |
folder) and type this command then press <i>RETURN</i>: |
| 708 |
<pre>mv ExifTool_config .ExifTool_config |
| 709 |
</pre></blockquote> |
| 710 |
|
| 711 |
With the sample config file installed, you should be able to write the example |
| 712 |
tags. A command like this: |
| 713 |
<pre>exiftool -v2 -NewXMPxmpTag=test <i>FILE</i></pre> |
| 714 |
should print this as the first line of its output: |
| 715 |
<pre>Writing XMP-xmp:NewXMPxmpTag |
| 716 |
</pre> |
| 717 |
If this doesn't work, the most common problem is that the |
| 718 |
"<code>.ExifTool_config</code>" configuration file isn't getting loaded. In |
| 719 |
this case, there are a few things you can try: |
| 720 |
<ol> |
| 721 |
<li>Make sure the config file name is correct. It must be |
| 722 |
"<code>.ExifTool_config</code>" (note the leading "<code>.</code>", and the |
| 723 |
capital "<code>T</code>").</li> |
| 724 |
<li>Set either the <b>HOME</b> or the <b>EXIFTOOL_HOME</b> environment variable |
| 725 |
to the name of the directory where you put your "<code>.ExifTool_config</code>" |
| 726 |
file.</li> |
| 727 |
<li>Put the config file in the same directory as the exiftool app. (Also, be |
| 728 |
sure the config filename starts with a dot! See the note above for help |
| 729 |
renaming the config file.)</li> |
| 730 |
<li>If you can't get the config file to load automatically, you can try loading |
| 731 |
it manually with the exiftool <code>-config <i>CFGFILE</i></code> option. (Note: |
| 732 |
This must be the first option on the command line.) This allows loading |
| 733 |
of a config file with any name.</li> |
| 734 |
</ol> |
| 735 |
</blockquote> |
| 736 |
|
| 737 |
<blockquote>If necessary, you can verify that ExifTool is loading your config |
| 738 |
file by adding the following line to your file: |
| 739 |
|
| 740 |
<pre>print "LOADED!\n"; |
| 741 |
</pre> |
| 742 |
|
| 743 |
If you see a "<code>LOADED!</code>" message when you run exiftool, but your new |
| 744 |
tags still don't work, make sure you are using the proper tag name and that the |
| 745 |
file you are writing can support this type of information.</blockquote> |
| 746 |
|
| 747 |
<blockquote>Note that all tag names in the config file are <b>case |
| 748 |
sensitive</b>. Specifically, the case must be correct for tag names in |
| 749 |
Composite tag Require/Desire entries. Also note that XMP tag names are |
| 750 |
generated automatically by capitalizing the tag ID unless the tag definition |
| 751 |
contains a "Name" entry.</blockquote> |
| 752 |
|
| 753 |
<blockquote class=prog><b>Programmers</b>: To specify the config file directory from within |
| 754 |
a Perl script when using the ExifTool API, set the <b>EXIFTOOL_HOME</b> |
| 755 |
environment variable before loading the ExifTool module: |
| 756 |
<pre>BEGIN { $ENV{EXIFTOOL_HOME} = '/config_file_directory' } |
| 757 |
use Image::ExifTool; |
| 758 |
</pre> |
| 759 |
Also see the <a href="ExifTool.html#Config">Configuration section of the |
| 760 |
ExifTool API documentation</a> for techniques to use a config file with another |
| 761 |
name, or to disable the config file feature. |
| 762 |
</blockquote> |
| 763 |
|
| 764 |
<a name="Q12"></a> |
| 765 |
<p>12. <b>"How do I export information from exiftool to a database?"</b></p> |
| 766 |
|
| 767 |
<blockquote><i>[See <a href="#Q26">FAQ number 26</a> for help with the reverse |
| 768 |
-- importing metadata from a database.]</i></blockquote> |
| 769 |
|
| 770 |
<blockquote> |
| 771 |
It is often easiest to export information formatted as a tab-delimited or |
| 772 |
comma-separated list of values using the exiftool <code>-T</code> or |
| 773 |
<code>-csv</code> option. As well, the <code>-r</code> option is useful for |
| 774 |
recursing through all images in a hierarchy of directories. For example: |
| 775 |
|
| 776 |
<pre>exiftool -T -r -filename -exposuremode -ISO t/images > out.txt |
| 777 |
</pre> |
| 778 |
|
| 779 |
This command recursively processes all images in the "<code>t/images</code>" |
| 780 |
directory, extracting FileName, ExposureMode and ISO tags, and writing the |
| 781 |
output to a tab-delimited text file called "<code>out.txt</code>". After the |
| 782 |
command has executed, "<code>out.txt</code>" will look something like this: |
| 783 |
|
| 784 |
<pre>Canon.jpg Manual 100 |
| 785 |
Casio.jpg - 64 |
| 786 |
Nikon.jpg - 100 |
| 787 |
OlympusE1.jpg Auto 400 |
| 788 |
</pre> |
| 789 |
|
| 790 |
One limitation of the <code>-T</code> option is that you must specify a list |
| 791 |
of tags to extract. Otherwise, all information is extracted from each input |
| 792 |
file, and the columns would contain values from random tags.</blockquote> |
| 793 |
|
| 794 |
<blockquote> The <code>-csv</code> (comma separated values) option solves this |
| 795 |
dilemma by pre-extracting information from all input files, then producing a |
| 796 |
sorted list of available tag names as the first row of the output, and |
| 797 |
organizing the information into columns for each tag. As well, a first column |
| 798 |
labelled "SourceFile" is generated. These features make it practical to use the |
| 799 |
<code>-csv</code> option for extracting all information from multiple images |
| 800 |
(but impractical for a large number of images due to memory restrictions). |
| 801 |
For example, this command: |
| 802 |
|
| 803 |
<pre>exiftool -csv -r t/images > out.csv</pre> |
| 804 |
|
| 805 |
gives an output like this: |
| 806 |
|
| 807 |
<pre>SourceFile,AEBBracketValue,AELock,AFAreaHeight,AFAreaMode,AFAreas,[...] |
| 808 |
t/images/Canon.jpg,0,,151,,,[...] |
| 809 |
t/images/Casio.jpg,,,,,,[...] |
| 810 |
t/images/Nikon.jpg,,,,Single Area,,[...] |
| 811 |
t/images/OlympusE1.jpg,,Off,,,"Center (121,121)-(133,133)",[...] |
| 812 |
</pre> |
| 813 |
|
| 814 |
Note that the number of columns in the <code>-csv</code> output may be very |
| 815 |
large if all information is extracted. Missing tags are indicated by empty |
| 816 |
strings as in the example above, or by dashes if the <code>-f</code> option is |
| 817 |
used.</blockquote> |
| 818 |
|
| 819 |
<blockquote> It should be possible to import these files directly into most |
| 820 |
database applications. On the command line, any list of tag names may be used, |
| 821 |
and any number of file or directory names may be specified. (Hint: If your |
| 822 |
command line starts to get too long, you may want to look into using the |
| 823 |
<code>-@</code> option and/or the <a href="index.html#shortcut">ShortCut</a> |
| 824 |
feature).</blockquote> |
| 825 |
|
| 826 |
<blockquote>In Windows, a .BAT file containing the exiftool command may be used |
| 827 |
to give drag and drop functionality. Dropping a folder on the following .BAT |
| 828 |
file will create "out.txt" in the folder: |
| 829 |
|
| 830 |
<pre>echo "FileName<tab>Aperture<tab>ISO" > %1\out.txt |
| 831 |
exiftool -T -r -filename -aperture -ISO %1 >> %1\out.txt |
| 832 |
</pre> |
| 833 |
|
| 834 |
The "<code>echo</code>" command was included to add column headings to the |
| 835 |
output. (The tab character in the echo command, indicated by |
| 836 |
"<code><tab></code>", may be generated in Mac/Linux shells with CTRL-v |
| 837 |
then TAB, or in a Windows cmd shell with TAB when cmd.exe is run with the |
| 838 |
<code>/f:off</code> option to disable tab completion.) |
| 839 |
</blockquote> |
| 840 |
|
| 841 |
<blockquote>Other possible export formats include RDF/XML (with the |
| 842 |
<code>-X</code> option), or JSON (with the <code>-j</code> option). These |
| 843 |
methods allow transfer of more complex data sets (including structured |
| 844 |
information with the <code>-struct</code> option), but require that the |
| 845 |
importing software supports these formats.</blockquote> |
| 846 |
|
| 847 |
<blockquote>Finally, the <code>-p</code> option may be used to generate any |
| 848 |
arbitrary output format. For example, the following format file |
| 849 |
(let's call it "<code>my.fmt</code>") may be used to emulate a CSV-formatted |
| 850 |
output: |
| 851 |
|
| 852 |
<pre>#[HEAD]FileName,Aperture,ISO |
| 853 |
$filename,$aperture,$iso |
| 854 |
</pre> |
| 855 |
|
| 856 |
with a command like this: |
| 857 |
|
| 858 |
<pre>exiftool -f -r -p my.fmt t/images > out.csv |
| 859 |
</pre> |
| 860 |
|
| 861 |
But note that any values containing commas, quotes or some other special |
| 862 |
characters may mess up the CSV formatting. If this is a possibility, the |
| 863 |
<code>-api filter</code> option may be added to the command to quote values |
| 864 |
if necessary. For example: |
| 865 |
|
| 866 |
<pre><span class='blk'># in a Windows CMD shell</span> |
| 867 |
exiftool -api filter="$_ = qq{""""$_""""} if s/""/""""/g or /(^\s+|\s+$)/ or /[,\n\r]/" ... |
| 868 |
|
| 869 |
<span class='blk'># in Mac/Linux</span> |
| 870 |
exiftool -api filter='$_ = qq{"$_"} if s/"/""/g or /(^\s+|\s+$)/ or /[,\n\r]/' ...</pre> |
| 871 |
|
| 872 |
The <code>-p</code> option argument may also be a format string instead of a |
| 873 |
file name. The following command has the same effect as above except that the |
| 874 |
row of headings is not printed (Note: Use single quotes as below on Mac/Linux, |
| 875 |
or double quotes instead on Windows): |
| 876 |
|
| 877 |
<pre>exiftool -f -r -p '$filename,$aperture,$iso' t/images > out.csv |
| 878 |
</pre> |
| 879 |
|
| 880 |
With the <code>-f</code> option, the value of any missing tag is printed as a |
| 881 |
dash (or the value of the |
| 882 |
<a href="ExifTool.html#MissingTagValue">API MissingTagValue option</a>, if set). |
| 883 |
Without this option, missing tags generate a minor warning and the line in the |
| 884 |
<code>-p</code> output is not printed. The <code>-m</code> option may be used |
| 885 |
to ignore minor warnings, which causes these lines to be printed with an empty |
| 886 |
value for missing tags.</blockquote> |
| 887 |
|
| 888 |
<blockquote> |
| 889 |
See the <code>-p</code> option in the <a href="exiftool_pod.html">application |
| 890 |
documentation</a> for more information about this feature. |
| 891 |
</blockquote> |
| 892 |
|
| 893 |
<a name="Q13"></a> |
| 894 |
<p>13a. <b>"Why is my file smaller after I use ExifTool to write information?"</b>, or |
| 895 |
<br>13b. <b>"Why do some Offset tags change value when I write other tags?"</b>, or |
| 896 |
<br>13c. <b>"How does editing a file with ExifTool affect image quality?"</b></p> |
| 897 |
|
| 898 |
<blockquote> |
| 899 |
There are various specific reasons why this can happen, but the general answer |
| 900 |
is: When ExifTool writes an image, the meta information may be restructured in |
| 901 |
such a way that it takes less space than in the original file, or so that some |
| 902 |
tags are stored at different offsets in the file.</blockquote> |
| 903 |
|
| 904 |
<blockquote>The EXIF/TIFF standard allows for blocks of unreferenced data to |
| 905 |
exist in an image. Some digital cameras write JPEG or TIFF-based RAW files |
| 906 |
which contain large blocks of unused data, usually filled with binary zeros. |
| 907 |
The reason for this could be to simplify camera algorithms by allowing |
| 908 |
variable-sized information to be written at fixed offsets in the output image. |
| 909 |
When ExifTool rewrites an image it does not copy these unused blocks. This can |
| 910 |
result in a significant reduction in file size for some images. <i>[The |
| 911 |
<code>-htmlDump</code> option may be used to view the file structure if you are |
| 912 |
interested in seeing these unused data blocks -- use a command like |
| 913 |
"<code>exiftool -htmlDump a.jpg > out.html</code>", then open |
| 914 |
<code>out.html</code> in your web browser. Unused data blocks are |
| 915 |
<span class=U>brown</span> in this output.]</i> </blockquote> |
| 916 |
|
| 917 |
<blockquote>Also, the size of an XMP record may easily shrink or grow when it is |
| 918 |
rewritten, even if no meta information is changed. This is partly due to the |
| 919 |
fact that the XMP specification recommends a few KB of padding at the end of the |
| 920 |
record (ExifTool adds 2424 bytes by default, but this padding is omitted if the |
| 921 |
<code>-z</code> command-line option or the |
| 922 |
<a href="ExifTool.html#Compact">API Compact</a> NoPadding setting is used), and |
| 923 |
partly due to the flexibility of the XMP format which allows the information to |
| 924 |
be written in various styles, some of which are more compact than others (the |
| 925 |
<code>-z</code> option and the <a href="ExifTool.html#Compact">API Compact</a> |
| 926 |
settings also cause a more compact form to be written). As well, the order |
| 927 |
of the tags in the XMP may change -- the specification doesn't dictate an order, |
| 928 |
and ExifTool sorts them alphabetically when writing.</blockquote> |
| 929 |
|
| 930 |
<blockquote>You may also notice that the values of some "offset" tags (like |
| 931 |
ThumbnailOffset and PreviewImageStart) may change when the file is rewritten. |
| 932 |
This is normal, and simply indicates that the associated data is now stored at a |
| 933 |
different position within the file.</blockquote> |
| 934 |
|
| 935 |
<blockquote>ExifTool does not modify the image data itself, so <b>editing a file |
| 936 |
with ExifTool is "lossless" as far as the image is concerned</b>.</blockquote> |
| 937 |
|
| 938 |
<a name="Q14"></a> |
| 939 |
<p>14a. <b>"What format do I use for writing GPS coordinates?"</b>, or<br> |
| 940 |
14b. <b>"How do I change the format of extracted GPS coordinates?"</b></p> |
| 941 |
|
| 942 |
<blockquote>ExifTool is very flexible in the formats allowed for entering GPS |
| 943 |
coordinates. Any string containing between 1 and 3 floating point numbers is |
| 944 |
valid. The numbers represent degrees, (and optionally) minutes and |
| 945 |
seconds with any number of decimal places.</blockquote> |
| 946 |
|
| 947 |
<blockquote>For EXIF GPS coordinates, the reference direction is specified |
| 948 |
separately with the EXIF:GPSLatitudeRef or EXIF:GPSLongitudeRef tag. |
| 949 |
GPSLatitudeRef may be written with a string containing "<code>N</code>", |
| 950 |
"<code>North</code>", "<code>S</code>" or "<code>South</code>", or with a signed |
| 951 |
coordinate value (positive for the northern hemisphere or negative for the |
| 952 |
south). GPSLongitudeRef accepts similar values, but for E/East (positive) and |
| 953 |
W/West (negative).</blockquote> |
| 954 |
|
| 955 |
<blockquote>For XMP GPS coordinates, the reference direction is specified within |
| 956 |
the XMP:GPSLatitude or XMP:GPSLongitude value, with west longitudes and south |
| 957 |
latitudes being specified either by negative coordinate values or by ending the |
| 958 |
string with "<code>W</code>" or "<code>S</code>". </blockquote> |
| 959 |
|
| 960 |
<blockquote>Here are some examples of equivalent ways to specify a GPS |
| 961 |
latitude in both EXIF and XMP: |
| 962 |
|
| 963 |
<pre>exiftool -exif:gpslatitude="42 30 0.00" -exif:gpslatituderef=S a.jpg |
| 964 |
exiftool -exif:gpslatitude="42 deg 30.00 min" -exif:gpslatituderef=S a.jpg |
| 965 |
exiftool -exif:gpslatitude=42.5 -exif:gpslatituderef=S a.jpg |
| 966 |
|
| 967 |
exiftool -xmp:gpslatitude="42 30 0.00 S" a.jpg |
| 968 |
exiftool -xmp:gpslatitude=42.50S a.jpg |
| 969 |
exiftool -xmp:gpslatitude=-42.5 a.jpg |
| 970 |
exiftool -xmp:gpslatitude="-42 -30" a.jpg |
| 971 |
</pre> |
| 972 |
|
| 973 |
Note the last example: The negative sign must be applied to all components of |
| 974 |
the coordinate. Similar styles may be used for longitude. ExifTool will convert |
| 975 |
any of these coordinate styles to the proper format for the specific tag used. |
| 976 |
</blockquote> |
| 977 |
|
| 978 |
<blockquote>ExifTool 12.22 and later allow combined lat/lon GPSCoordinates |
| 979 |
values to be written to GPSLatitude and GPSLongitude, and the appropriate |
| 980 |
latitude or longitude part will be pulled from the input string. Version 12.36 |
| 981 |
and later make Composite:GPSPosition writable, allowing EXIF GPS coorinates and |
| 982 |
reference directions to be all writable via a single tag: |
| 983 |
|
| 984 |
<pre><span class='blk'># write all 4 EXIF GPS tags (version 12.36 and later)</span> |
| 985 |
exiftool -gpsposition="42 30 0.00 S, 33 15 0.00 W" |
| 986 |
exiftool -gpsposition="-42.5, -33.25"</pre> |
| 987 |
|
| 988 |
Version 12.44 and later make Composite:GPSLatitude/GPSLongitude writable, |
| 989 |
allowing the separate EXIF coordinate and reference direction tags to be written |
| 990 |
together. (Note that the Composite group must be specified here because these |
| 991 |
tags are otherwise avoided when writing due to possible confusion when |
| 992 |
attempting to write EXIF tags.) |
| 993 |
|
| 994 |
<pre><span class='blk'># write EXIF:GPSLatitude and GPSLatitudeRef together (12.44 and later)</span> |
| 995 |
exiftool -composite:gpslatitude="42 30 0.00 S" a.jpg |
| 996 |
exiftool -composite:gpslatitude="-42.5" a.jpg</pre></blockquote> |
| 997 |
|
| 998 |
<blockquote>When reading, by default ExifTool reports coordinates in the format |
| 999 |
<pre>DDD deg MM' SS.SS"</pre> |
| 1000 |
where <code>DDD</code> is degrees, <code>MM</code> is minutes, and <code>SS.SS</code> |
| 1001 |
is seconds. The <code>-n</code> option may be used to change this to decimal |
| 1002 |
degrees, or any arbitrary format may be specified with the <code>-c</code> |
| 1003 |
command-line option (see the <a href="exiftool_pod.html">application documentation</a>), |
| 1004 |
or the <a href="ExifTool.html#CoordFormat">API CoordFormat option</a>. |
| 1005 |
</blockquote> |
| 1006 |
|
| 1007 |
<a name="Q15"></a> |
| 1008 |
<p>15. <b>"I get MakerNote warnings or errors when reading or writing information"</b></p> |
| 1009 |
|
| 1010 |
<blockquote>Problems like this may be caused by image editing software which |
| 1011 |
doesn't properly update offsets in the MakerNotes when rewriting an image. These |
| 1012 |
offsets are used as pointers to reference tag values and structures within the |
| 1013 |
metadata, and errors like this may lead to missing or incorrect values for some |
| 1014 |
MakerNotes tags. In many cases, ExifTool will detect this type of problem and |
| 1015 |
issue a warning like this when reading (or an error when writing): |
| 1016 |
|
| 1017 |
<pre>Warning: [minor] Possibly incorrect maker notes offsets (fix by -340?) |
| 1018 |
</pre> |
| 1019 |
|
| 1020 |
<i class=lt>[Be aware that if multiple warnings occur, the <code>-a</code> |
| 1021 |
option must be used to see them all, since by default only one warning is |
| 1022 |
displayed per file.]</i> </blockquote> |
| 1023 |
|
| 1024 |
<blockquote>This is a particularly insidious problem that is sometimes difficult |
| 1025 |
for ExifTool to correct automagically, so it requires some operator |
| 1026 |
intervention. If this warning occurs, you have a few alternatives:</blockquote> |
| 1027 |
|
| 1028 |
<blockquote>1) Use the <code>-F</code> option to allow ExifTool to attempt to |
| 1029 |
fix the incorrect offsets. If ExifTool was correct in its diagnosis, then this |
| 1030 |
option will fix the incorrect offsets. This is usually the appropriate choice |
| 1031 |
if this problem was caused by editing the image with other |
| 1032 |
software.</blockquote> |
| 1033 |
|
| 1034 |
<blockquote>2) Use the <code>-m</code> option to ignore the warning (or downgrade |
| 1035 |
the error to a warning when writing). This causes ExifTool to honour the |
| 1036 |
existing maker note offsets, and may be the correct choice if images straight |
| 1037 |
out of the camera have this problem.</blockquote> |
| 1038 |
|
| 1039 |
<blockquote>Often, the first choice (<code>-F</code>) is the right thing to do, |
| 1040 |
but this depends on many factors, so it is best to try both methods then compare |
| 1041 |
the resulting maker note information to see which works best for your |
| 1042 |
situation.</blockquote> |
| 1043 |
|
| 1044 |
<blockquote>When writing, <code>-F</code> applies a permanent correction to the |
| 1045 |
maker notes. Note that <u>some MakerNote information may be lost permanently |
| 1046 |
if the proper correction is not applied when writing images with this |
| 1047 |
problem</u>.</blockquote> |
| 1048 |
|
| 1049 |
<blockquote>3) The third alternative is to adjust the maker note offsets by a |
| 1050 |
specific amount. This is done by appending an integer to the <code>-F</code> |
| 1051 |
option. For example, with the warning above (where ExifTool suggests "fix by |
| 1052 |
-340?"), <code>-F</code> would be equivalent to <code>-F-340</code>. See the |
| 1053 |
<a href="exiftool_pod.html#F-OFFSET--fixBase">-F option documentation</a> for |
| 1054 |
more details. This advanced feature may require some technical knowledge about |
| 1055 |
the structure of EXIF information (and here, ExifTool's <code>-htmlDump</code> |
| 1056 |
feature may be very useful for visualizing this structure).</blockquote> |
| 1057 |
|
| 1058 |
<blockquote>Other types of MakerNote errors may also prevent the file from |
| 1059 |
being written. However, most MakerNote errors are designated as <b>minor</b>, |
| 1060 |
which allows them to be ignored by using the <code>-m</code> option. For |
| 1061 |
example: |
| 1062 |
|
| 1063 |
<pre>Error: [minor] Bad format (65535) for MakerNotes entry 17 |
| 1064 |
</pre> |
| 1065 |
|
| 1066 |
Using <code>-m</code> will downgrade the minor error to a warning, allowing the |
| 1067 |
file to be written, but <u>some MakerNote information may be lost when ignoring |
| 1068 |
errors like this</u>.</blockquote> |
| 1069 |
|
| 1070 |
<blockquote>You may also get one of these warnings when reading or writing a |
| 1071 |
file containing unknown maker notes: |
| 1072 |
|
| 1073 |
<pre>Warning: [minor] Unrecognized MakerNotes |
| 1074 |
Warning: [minor] Maker notes could not be parsed</pre> |
| 1075 |
|
| 1076 |
These warnings indicate that ExifTool didn't recognize the maker notes in a |
| 1077 |
file, so it couldn't extract any information from them when reading, or had to |
| 1078 |
copy the maker notes as a block when writing. If the maker notes contain |
| 1079 |
absolute offsets then this could result in corrupted makernote information when |
| 1080 |
writing, but this is very unlikely.</blockquote> |
| 1081 |
|
| 1082 |
<a name="Q16"></a> |
| 1083 |
<p>16. <b>"Why doesn't ExifTool rename my video files?"</b></p> |
| 1084 |
|
| 1085 |
<blockquote>By default, ExifTool only processes <u>writable file types</u> |
| 1086 |
<span class='sm'><sup>†</sup></span> when <u>any tag</u> |
| 1087 |
<span class='sm'><sup>‡</sup></span> is being written and a directory |
| 1088 |
name is specified on the command line, so AVI files won't be processed by |
| 1089 |
default. To force exiftool to process other files, they must either be listed |
| 1090 |
on the command line by name, or be specified using the <code>-ext</code> or |
| 1091 |
<code>-ext+</code> option, something like this: |
| 1092 |
|
| 1093 |
<pre><span class=blk># process AVI files in addition to other writable file types</span> |
| 1094 |
exiftool -ext+ AVI -d pics/%Y/%m "-directory<dateTimeOriginal" DIR |
| 1095 |
|
| 1096 |
<span class=blk># process only AVI and JPG files</span> |
| 1097 |
exiftool -ext AVI -ext JPG -d pics/%Y/%m "-directory<dateTimeOriginal" DIR |
| 1098 |
</pre> |
| 1099 |
|
| 1100 |
When <code>-ext</code> is used, only files with the specified extension(s) are |
| 1101 |
processed, however <code>-ext+</code> may be used to add to the list of normally |
| 1102 |
processed files (as in the first example above). Multiple <code>-ext</code> or |
| 1103 |
<code>-ext+</code> options may be used in the same command (as in the second |
| 1104 |
example above) to process any number of different file types, or |
| 1105 |
<code>-ext "*"</code> may be used to process files with any extension (or none at all). |
| 1106 |
</blockquote> |
| 1107 |
|
| 1108 |
<blockquote><b>Note:</b> The above commands generally still won't work for |
| 1109 |
MOV/MP4 videos because these files typically don't contain a DateTimeOriginal |
| 1110 |
tag. For these types of files, CreateDate should be used instead (possibly with |
| 1111 |
the addition of <code>-api QuickTimeUTC</code> if these timestamps are based on |
| 1112 |
UTC). Use this command to see which date/time tags are available: |
| 1113 |
|
| 1114 |
<pre>exiftool -time:all -a -G1 -s FILE</pre></blockquote> |
| 1115 |
|
| 1116 |
<blockquote class='sm'><sup>†</sup> <span class=lt>The |
| 1117 |
<code>-listwf</code> option may be used to list the extensions of all writable |
| 1118 |
file types, or see <a href="index.html#supported">here</a> for a table of |
| 1119 |
supported file types.</span> |
| 1120 |
<br><sup>‡</sup> <span class=lt>This includes "pseudo" tags like |
| 1121 |
FileName, Directory, FileModifyDate and FileCreateDate.</span></blockquote> |
| 1122 |
|
| 1123 |
<a name="Q17"></a> |
| 1124 |
<p>17. <b>"List-type tags do not behave as expected"</b></p> |
| 1125 |
|
| 1126 |
<blockquote>Tags indicated by a plus sign (<code>+</code>) in the |
| 1127 |
<a href="TagNames/index.html">tag name documentation</a> are list-type tags. |
| 1128 |
Two examples of common list-type tags are |
| 1129 |
<a href="TagNames/IPTC.html#ApplicationRecord">IPTC:Keywords</a> and |
| 1130 |
<a href="TagNames/XMP.html#dc">XMP:Subject</a>. These tags may contain multiple |
| 1131 |
items which are combined into a single string when reading. (By default, |
| 1132 |
extracted list items are separated by a comma and a space, but the |
| 1133 |
<code>-sep</code> option may be used to change this.) When writing, separate |
| 1134 |
items are assigned individually. For example, the following command writes |
| 1135 |
three keywords to all writable files in directory <code>DIR</code>, replacing |
| 1136 |
any previously existing keywords: |
| 1137 |
|
| 1138 |
<pre>exiftool -keywords=one -keywords=two -keywords=three DIR |
| 1139 |
</pre> |
| 1140 |
|
| 1141 |
List items are assigned separately as above, NOT all together, because this |
| 1142 |
would represent a single keyword: |
| 1143 |
|
| 1144 |
<pre>exiftool -keywords="one, two, three" test.jpg <i class=blk>(WRONG!)</i> |
| 1145 |
</pre> |
| 1146 |
|
| 1147 |
The <code>-sep</code> option may be used to split values of list-type tags into |
| 1148 |
separate items when writing. For example, |
| 1149 |
|
| 1150 |
<pre>exiftool -sep ", " -keywords="one, two, three" DIR |
| 1151 |
</pre> |
| 1152 |
|
| 1153 |
will store three separate keywords, the same as the first example above. This |
| 1154 |
feature may also be used to split a tag value into separate items if it was |
| 1155 |
originally stored incorrectly as a single string: |
| 1156 |
|
| 1157 |
<pre>exiftool -sep ", " -tagsfromfile @ -keywords test.jpg |
| 1158 |
</pre> |
| 1159 |
|
| 1160 |
However, sometimes it is desirable to have list items which contain a comma, and |
| 1161 |
this is allowed: |
| 1162 |
|
| 1163 |
<pre>exiftool -contributor="Harvey, Phil" -contributor="Marley, Bob" a.jpg |
| 1164 |
</pre> |
| 1165 |
|
| 1166 |
But to distinguish these entries when extracting information, a different list |
| 1167 |
separator or a different output format must be used. For instance, the |
| 1168 |
following command uses "<code>//</code>" to separate list items, |
| 1169 |
|
| 1170 |
<pre>exiftool -contributor -sep "//" a.jpg |
| 1171 |
</pre> |
| 1172 |
|
| 1173 |
and produces an output like this: |
| 1174 |
|
| 1175 |
<pre class=blk>Contributor : Harvey, Phil//Marley, Bob |
| 1176 |
</pre> |
| 1177 |
|
| 1178 |
Alternatively, the <code>-j</code>, <code>-php</code> and <code>-X</code> |
| 1179 |
options use an output format which preserves the structure of a |
| 1180 |
list (if <code>-sep</code> is NOT used).</blockquote> |
| 1181 |
|
| 1182 |
<blockquote>Note that the writing examples above overwrite any values which |
| 1183 |
already existed in the original file for these tags. Instead, to add or delete |
| 1184 |
items from an existing list, use "<code>+=</code>" or "<code>-=</code>" in place |
| 1185 |
of "<code>=</code>". For example: |
| 1186 |
|
| 1187 |
<pre>exiftool -keywords+="add this" -keywords-="remove this" DIR |
| 1188 |
</pre> |
| 1189 |
|
| 1190 |
With commands like this, new items are added to the list in place of the first |
| 1191 |
deleted item, or at the end of the list if no items were removed.</blockquote> |
| 1192 |
|
| 1193 |
<blockquote>Note: Using "<code>=</code>" is equivalent to "<code>+=</code>" in |
| 1194 |
any command where the same List-type tag is set with "<code>+=</code>" or |
| 1195 |
"<code>-=</code>" in another assignment. (ie. existing items will be preserved |
| 1196 |
unless specifically deleted with "<code>-=</code>".) <i class=lt>[For non |
| 1197 |
List-type tags, "<code>+=</code>" has a different meaning, and is used to |
| 1198 |
increment numerical values or shift dates.]</i></blockquote> |
| 1199 |
|
| 1200 |
<blockquote><a name="nodups"></a><b>To prevent duplication when adding new |
| 1201 |
items</b>, specific items can be deleted then added back again in the same |
| 1202 |
command. For example, the following command adds the keywords "one" and "two", |
| 1203 |
ensuring that they are not duplicated if they already existed in the keywords of |
| 1204 |
an image: |
| 1205 |
|
| 1206 |
<pre>exiftool -keywords-=one -keywords+=one -keywords-=two -keywords+=two DIR |
| 1207 |
</pre> |
| 1208 |
|
| 1209 |
When <b>copying list tags</b> using the <code>-tagsFromFile</code> feature, |
| 1210 |
items are copied individually to form proper lists if the tag is copied directly |
| 1211 |
(note that <code>-tagsFromFile @</code> is implied by the "<code><</code>" |
| 1212 |
operation in this and the following commands, causing tags to be copied from the |
| 1213 |
original file): |
| 1214 |
|
| 1215 |
<pre>exiftool "-keywords<subject" DIR</pre> |
| 1216 |
|
| 1217 |
However, this is not the case if the tag is interpolated within a format string |
| 1218 |
(ie. has a leading "<code>$</code>" symbol), like this |
| 1219 |
|
| 1220 |
<pre>exiftool "-keywords<$subject" DIR <i class=blk>(WRONG!)</i></pre> |
| 1221 |
|
| 1222 |
but here the <code>-sep</code> option may be used to split the list back into |
| 1223 |
separate items: |
| 1224 |
|
| 1225 |
<pre>exiftool "-keywords<$subject" -sep "//" DIR</pre> |
| 1226 |
|
| 1227 |
Note there is a complication when <b>copying multiple tags to a single list</b> |
| 1228 |
tag: Here, any assignment to a tag overrides earlier assignments to the same |
| 1229 |
tag in the command. For instance, this command: |
| 1230 |
|
| 1231 |
<pre>exiftool "-keywords<filename" "-keywords<comment" DIR <i class=blk>(WRONG!)</i> |
| 1232 |
</pre> |
| 1233 |
|
| 1234 |
writes only the value from the Comment tag. This may seem strange, but it prevents |
| 1235 |
duplicate items from being added to a list when copying a group of tags from a |
| 1236 |
file containing duplicate information. Alternatively, multiple tags may be copied to a |
| 1237 |
single list either by adding a leading <code>+</code> or by using the |
| 1238 |
<code>-addTagsFromFile</code> option: |
| 1239 |
|
| 1240 |
<pre>exiftool "-keywords<filename" "-+keywords<comment" DIR |
| 1241 |
</pre> |
| 1242 |
|
| 1243 |
or |
| 1244 |
|
| 1245 |
<pre>exiftool -addTagsFromFile @ "-keywords<filename" "-keywords<comment" DIR |
| 1246 |
</pre> |
| 1247 |
|
| 1248 |
Except for adding instead of replacing queued list values, the <code>-addTagsFromFile</code> |
| 1249 |
option is identical to <code>-tagsFromFile</code>, but using <code>"-+TAG<SRCTAG"</code> |
| 1250 |
is more flexible because it may be applied on a per-tag basis.</blockquote> |
| 1251 |
|
| 1252 |
<blockquote>But note that the "<code><</code>" operation still overwrites any Keywords |
| 1253 |
that existed previously in the original file. To add to or remove from the existing |
| 1254 |
keywords, use "<code>+<</code>" or "<code>-<</code>". |
| 1255 |
</blockquote> |
| 1256 |
|
| 1257 |
<blockquote>One final note: When copying the contents of two other |
| 1258 |
tags into a single list, or if one of the source lists may already contain |
| 1259 |
duplicates, the <a href="ExifTool.html#NoDups">API NoDups option</a> may be |
| 1260 |
used to remove duplicate items from list values that are queued for writing. |
| 1261 |
For example, |
| 1262 |
|
| 1263 |
<pre>exiftool -tagsfromfile a.jpg -subject -tagsfromfile b.jpg -+subject -api nodups c.jpg |
| 1264 |
</pre> |
| 1265 |
|
| 1266 |
combines Subject items from a.jpg and b.jpg and writes them without duplicates |
| 1267 |
to c.jpg (overwriting any previous Subject in c.jpg). Or to remove duplicates that |
| 1268 |
may already exist in the target file when adding new items: |
| 1269 |
|
| 1270 |
<pre>exiftool -tagsfromfile @ -subject -subject="new item" -api nodups target.jpg</pre> |
| 1271 |
</blockquote> |
| 1272 |
|
| 1273 |
<a name="Q18"></a> |
| 1274 |
<p>18a. <b>"Special characters don't display properly in my Windows console"</b>, or |
| 1275 |
<br>18b. <b>"I'm having problems with special characters on the Windows command line"</b></p> |
| 1276 |
|
| 1277 |
<blockquote>The Windows cmd.exe console uses an MS-DOS encoding by default |
| 1278 |
(cp437 or something similar, depending on your region). The exiftool |
| 1279 |
<code>-charset</code> option may be used to encode the exiftool output for a |
| 1280 |
specific Windows code page, which may help display some special characters, but |
| 1281 |
instead it may be better to switch the console to UTF‑8 (the native |
| 1282 |
ExifTool character encoding). This is especially useful if you are using the |
| 1283 |
<code>-lang</code> option to translate exiftool output to another language. To |
| 1284 |
change the Windows console to UTF‑8, follow these steps: |
| 1285 |
|
| 1286 |
<ol><li>Run "cmd.exe" to open a Windows console (select "Run..." from the |
| 1287 |
Start menu and enter "cmd").</li> |
| 1288 |
<li>Change the font in the console Properties to any True Type font (eg. "TT |
| 1289 |
Lucida Console").</li> |
| 1290 |
<li>Type "<code>chcp 65001</code>" then press ENTER at the command prompt.</li> |
| 1291 |
</ol> |
| 1292 |
|
| 1293 |
The console should now be able to display UTF‑8 characters (cp65001). But |
| 1294 |
note that the TT Lucida Console font shipped with Windows, at least my version, |
| 1295 |
may not be very complete, and doesn't seem to contain Japanese or Chinese |
| 1296 |
characters.</blockquote> |
| 1297 |
|
| 1298 |
<blockquote>To permanently set the font, select "Save properties for future |
| 1299 |
windows" when changing the font Properties. Also, you can automatically run |
| 1300 |
"<code>chcp 65001</code>" every time "cmd.exe" is launched by changing the |
| 1301 |
Windows Registry for the Command Processor: Run "regedit" and put "<code>chcp |
| 1302 |
65001</code>" into Data field for "HKEY_LOCAL_MACHINE\Software\Microsoft\Command |
| 1303 |
Processor\Autorun". (Unfortunately, I haven't been able to figure out how to |
| 1304 |
change the code page for exiftool when launched via the Windows GUI. If anyone |
| 1305 |
can figure out how to do this, please let me know.) |
| 1306 |
</blockquote> |
| 1307 |
|
| 1308 |
<blockquote>Note that Windows will <b>recode arguments on the command |
| 1309 |
line</b> from the current console code page to the system code page, so the |
| 1310 |
ExifTool <code>-charset</code> should be set to the system code page for |
| 1311 |
command-line arguments. However, this technique may yield unexpected results |
| 1312 |
since not all characters may be represented using the system code page. To get |
| 1313 |
around this limitation, arguments may be read from an ExifTool argument file |
| 1314 |
using the <code>-@</code> option. UTF‑8 encoding is recommended for the |
| 1315 |
argument file, and with this you would also set <code>-charset filename=utf8</code> |
| 1316 |
if using special characters in filename arguments within the file.</blockquote> |
| 1317 |
|
| 1318 |
<blockquote>Also see |
| 1319 |
<a href="https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window/57134096#57134096">this StackOverflow answer</a> |
| 1320 |
for another possible solution, but note that this option has the side effect of |
| 1321 |
changing the fonts of some older programs and causing problems with their GUIs, |
| 1322 |
so you'll have to decide whether this is acceptable for you.</blockquote> |
| 1323 |
|
| 1324 |
<blockquote>Another way to bypass the console/command-line encoding problems for |
| 1325 |
individual tag values is to extract/write to/from a separate text file and use a |
| 1326 |
UTF‑8 aware text editor to view/edit the text. For example: |
| 1327 |
|
| 1328 |
<pre><span class=blk># extracting...</span> |
| 1329 |
exiftool image.jpg > out.txt |
| 1330 |
|
| 1331 |
<span class=blk># writing...</span> |
| 1332 |
exiftool "-subject<=subject.txt" image.jpg</pre></blockquote> |
| 1333 |
|
| 1334 |
<a name="Q19"></a> |
| 1335 |
<p>19. <b>"How do I change the format of an extracted tag value?"</b></p> |
| 1336 |
|
| 1337 |
<blockquote>The exiftool application has built-in options which allow you to |
| 1338 |
display numeric values (<code>-n</code>), escape special HTML characters |
| 1339 |
(<code>-E</code>), and change the date/time (<code>-d</code>) and GPS coordinate |
| 1340 |
(<code>-c</code>) formats, but sometimes more control is needed over the |
| 1341 |
formatting of a value...</blockquote> |
| 1342 |
|
| 1343 |
<blockquote>The <code>-p</code> and <code>-tagsFromFile</code> options provide |
| 1344 |
an advanced translation feature that allows arbitrary Perl expressions to be |
| 1345 |
used to modify tag values. The basic syntax is this: |
| 1346 |
|
| 1347 |
<pre>${TAG;EXPR}</pre> |
| 1348 |
|
| 1349 |
where <code>TAG</code> is the tag name, and <code>EXPR</code> is a Perl |
| 1350 |
expression acting on the default input variable (<code>$_</code>), which is |
| 1351 |
initially the original value of the tag. For example, the following command |
| 1352 |
sets the FileName from Artist, translating spaces to underlines: |
| 1353 |
|
| 1354 |
<pre>exiftool '-filename<${artist;tr/ /_/}.%e' image.jpg</pre> |
| 1355 |
|
| 1356 |
(Note: Use single quotes as above in Mac/Linux, or double quotes instead |
| 1357 |
in Windows.)</blockquote> |
| 1358 |
|
| 1359 |
<blockquote>Another technique is to create a user-defined Composite tag to do |
| 1360 |
the reformatting. Here is a basic config file that reformats the Artist tag to |
| 1361 |
provide a new MyArtist tag with the same character translation as the example |
| 1362 |
above: |
| 1363 |
|
| 1364 |
<pre>%Image::ExifTool::UserDefined = ( |
| 1365 |
'Image::ExifTool::Composite' => { |
| 1366 |
MyArtist => { |
| 1367 |
Require => 'Artist', |
| 1368 |
ValueConv => '$val =~ tr/ /_/; $val', |
| 1369 |
}, |
| 1370 |
}, |
| 1371 |
); |
| 1372 |
1; # end |
| 1373 |
</pre> |
| 1374 |
|
| 1375 |
With this config file, an Artist value of "Phil Harvey" yields a corresponding |
| 1376 |
MyArtist value of "Phil_Harvey". The ValueConv string may be any valid Perl |
| 1377 |
expression, and is evaluated to obtain the value for the new tag. In this |
| 1378 |
expression, <code>$val</code> represents the ValueConv value of the Require'd |
| 1379 |
tag. </blockquote> |
| 1380 |
|
| 1381 |
<blockquote>To activate the config file, it must be named |
| 1382 |
"<code>.ExifTool_config</code>" and placed either in your home directory or in |
| 1383 |
the same directory as the exiftool application. Note that the file name begins |
| 1384 |
with a "<code>.</code>", so if you are in Windows or on a Mac you may need to |
| 1385 |
rename the file from the command line since the GUI might not like file names |
| 1386 |
beginning with a "<code>.</code>". <i class=lt>[An alternative is to load the |
| 1387 |
config file with the <code>-config</code> option -- see the |
| 1388 |
<a href="exiftool_pod.html#config-CFGFILE">application documentation</a> |
| 1389 |
for details.]</i></blockquote> |
| 1390 |
|
| 1391 |
<blockquote>User-defined Composite tags have many other features, including the |
| 1392 |
ability to combine the values of multiple tags. See the |
| 1393 |
<a href="config.html">config file documentation</a> for more details about |
| 1394 |
user-defined tags, and lib/Image/ExifTool/README in the full distribution for a |
| 1395 |
complete description of ValueConv features. Also, a |
| 1396 |
<a href="https://exiftool.org/forum/index.php?action=search2&search=code+userdefined">quick |
| 1397 |
search of the ExifTool forum</a> should reveal a number of user-defined tag |
| 1398 |
examples, and there are other good (and often more complex) examples which can |
| 1399 |
be found in the %Image::ExifTool::Exif::Composite hash of the |
| 1400 |
lib/Image/ExifTool/Exif.pm source code. |
| 1401 |
</blockquote> |
| 1402 |
|
| 1403 |
<a name="Q20"></a> |
| 1404 |
<p>20a. <b>"ExifTool won't write an image due to errors"</b>, or |
| 1405 |
<br>20b. <b>"How do I repair corrupted EXIF?"</b></p> |
| 1406 |
|
| 1407 |
<blockquote>Minor errors may be ignored using the <code>-m</code> option |
| 1408 |
(<a href="#Q15">FAQ 15</a> discusses this with respect to MakerNote errors), but |
| 1409 |
sometimes there are more serious errors which can't be ignored. ExifTool may be |
| 1410 |
used to fix metadata problems in JPEG images by deleting all metadata and |
| 1411 |
rebuilding it from scratch. The command looks like this: |
| 1412 |
|
| 1413 |
<pre>exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile bad.jpg |
| 1414 |
</pre> |
| 1415 |
|
| 1416 |
where "<code>bad.jpg</code>" is the name of the image that requires fixing. This |
| 1417 |
command deletes all metadata then copies all writable tags that can be extracted |
| 1418 |
from the original image to the same locations in the updated image. The |
| 1419 |
"<code>Unsafe</code>" tag is a <a href="TagNames/Shortcuts.html">shortcut</a> |
| 1420 |
for unsafe EXIF tags in JPEG images which are not normally copied. JPEG images |
| 1421 |
may also contain an ICC color profile which should be preserved. The |
| 1422 |
"<code>ICC_Profile</code>" tag is also marked as unsafe, but is not part of the |
| 1423 |
EXIF so it isn't covered by the "<code>Unsafe</code>" shortcut and must be |
| 1424 |
specified separately.</blockquote> |
| 1425 |
|
| 1426 |
<blockquote>After repairing an image like this you should be able to write to it |
| 1427 |
without errors, but note that <u>some metadata from the original image may have |
| 1428 |
been lost in the process</u>.</blockquote> |
| 1429 |
|
| 1430 |
<blockquote><b>Note</b>: ExifTool will not modify the JPEG image data, so if the |
| 1431 |
image itself is corrupted (eg. if you get a message saying "Not a valid JPEG"), |
| 1432 |
then ExifTool can not be used to repair the image. Also, ExifTool may not |
| 1433 |
be used like this to repair TIFF-based files or RAW files -- the risk of image |
| 1434 |
corruption is too great because the image is stored in the same IFD as the |
| 1435 |
metadata in these files.</blockquote> |
| 1436 |
|
| 1437 |
<blockquote>If there are also MakerNote problems in the file, you may want to |
| 1438 |
add the <code>-F</code> option to the command. See <a href='#Q15'>FAQ 15</a> |
| 1439 |
for details. For example, to rebuild the EXIF only and fix the MakerNote |
| 1440 |
offsets you could do this: |
| 1441 |
|
| 1442 |
<pre>exiftool -exif:all= -tagsfromfile @ -exif:all -unsafe -F bad.jpg |
| 1443 |
</pre> |
| 1444 |
|
| 1445 |
<b>Advanced</b>: The byte order of the newly created EXIF is set by the value of |
| 1446 |
the ExifByteOrder tag. Since this tag does not belong to the EXIF group, it is |
| 1447 |
not copied with <code>-exif:all</code> above (but would be copied with |
| 1448 |
<code>-all:all</code> as in the first example). If ExifByteOrder is not set |
| 1449 |
then the byte order is determined by the ordering of the MakerNotes if they are |
| 1450 |
copied, otherwise big-endian ("MM") byte order is used by default. |
| 1451 |
ExifByteOrder may be set to a specific value to force a particular byte order |
| 1452 |
when creating new EXIF (eg. "<code>-ExifByteOrder=II</code>" for little-endian). |
| 1453 |
</blockquote> |
| 1454 |
|
| 1455 |
<a name="Q21"></a> |
| 1456 |
<p>21. <b>"How do I read/write values containing newline characters?"</b></p> |
| 1457 |
|
| 1458 |
<blockquote>When reading, by default exiftool converts all control characters to |
| 1459 |
"." to avoid messing up the output formatting, so newlines will appear as a "." |
| 1460 |
in the output. The <code>-b</code> option may be used to bypass all output |
| 1461 |
formatting (except that a line-feed character or other separator specified by |
| 1462 |
the <code>-sep</code> option is inserted between items in a list), but this may |
| 1463 |
not be appropriate when the values of many tags must be extracted. In this |
| 1464 |
case, the formatted output (<code>-p</code>), JSON (<code>-j</code>), XML |
| 1465 |
(<code>-X</code>) and PHP (<code>-php</code>) options provide alternative output |
| 1466 |
formats which preserve newlines in values.</blockquote> |
| 1467 |
|
| 1468 |
<blockquote>Alternatively, the <a href="ExifTool.html#Filter">API Filter option</a> |
| 1469 |
may be used to apply an arbitrary filter to all extracted values. For example, |
| 1470 |
the following command changes newlines to "\n": |
| 1471 |
|
| 1472 |
<pre>exiftool -api filter="s/\n/\\n/g" FILE</pre> |
| 1473 |
|
| 1474 |
When writing, there are a number of options: |
| 1475 |
|
| 1476 |
<ol type='a'> |
| 1477 |
<li>In many shells, a newline may be inserted directly in the command |
| 1478 |
line: |
| 1479 |
<p>Bourne shells (press <i>RETURN</i> inside a quoted string)</p> |
| 1480 |
<pre>exiftool -comment="line 1 |
| 1481 |
line 2" image.jpg |
| 1482 |
</pre> |
| 1483 |
<p>(Also, in Bourne shells the character sequence <code>$'\n'</code> |
| 1484 |
may be used for a newline.)</p> |
| 1485 |
<p>C shells (press "<code>\</code>" then <i>RETURN</i> inside a quoted string)</p> |
| 1486 |
<pre>exiftool -comment="line 1\ |
| 1487 |
line 2" image.jpg |
| 1488 |
</pre> |
| 1489 |
<i class=lt>[Unfortunately the Windows cmd shell provides no method to get a |
| 1490 |
newline (CR/LF in Windows) into the command line. A linefeed (LF) may be |
| 1491 |
inserted with CTRL-T, but I have found no way to insert a carriage return |
| 1492 |
(CR).]</i><br><br> |
| 1493 |
</li> |
| 1494 |
<li>Use the <code>-ec</code> or <code>-E</code> option to allow C-style escape |
| 1495 |
sequences or HTML character entities (Note: |
| 1496 |
In Windows a newline is "<code>\r\n</code>" or "<code>&#xd;&#xa;</code>" |
| 1497 |
instead of just "<code>\n</code>" or "<code>&#xa;</code>"). For example, |
| 1498 |
using C-style escape sequences: |
| 1499 |
<pre>exiftool -ec "-comment=line 1\nline 2" image.jpg</pre> |
| 1500 |
or using HTML character entities: |
| 1501 |
<pre>exiftool -E "-comment=line 1&#xa;line 2" image.jpg</pre> |
| 1502 |
</li> |
| 1503 |
<li>Write the tag from the contents of a separate text file: |
| 1504 |
<pre>exiftool "-comment<=file.txt" image.jpg |
| 1505 |
</pre></li> |
| 1506 |
<li>Use <code>$/</code> in a redirection expression: (Note: Single quotes |
| 1507 |
must be used in Mac/Linux shells around arguments containing a dollar sign, |
| 1508 |
but double quotes are used instead in Windows. Also note that this technique |
| 1509 |
is slower since the implied <code>-tagsFromFile</code> adds an extra unnecessary |
| 1510 |
processing pass to read tags from the file, but most of this delay may be |
| 1511 |
avoided with the <code>-fast3</code> option.) |
| 1512 |
<pre>exiftool '-comment<line 1$/line 2' image.jpg |
| 1513 |
</pre></li> |
| 1514 |
<li>Use the "<code>#[CSTR]</code>" feature to allow C-style escape sequences |
| 1515 |
for a specific line in a <code>-@</code> argfile. For example, this command: |
| 1516 |
<pre>exiftool -@ test.args image.jpg</pre> |
| 1517 |
with this "test.args" file: |
| 1518 |
<pre>#[CSTR]-comment=line 1\nline 2</pre></li> |
| 1519 |
</ol> |
| 1520 |
</blockquote> |
| 1521 |
|
| 1522 |
<a name="Q22"></a> |
| 1523 |
<p>22. <b>"In what order are command-line assignments applied when writing?"</b></p> |
| 1524 |
|
| 1525 |
<blockquote>When writing, tag assignments on the command line are queued and |
| 1526 |
applied together as each target file is processed. In general, assignments |
| 1527 |
later on the command line override earlier assignments (ie. they are evaluated |
| 1528 |
left-to-right), but there are exceptions: |
| 1529 |
<ol><li>When writing list-type tags (eg. <code>-keywords=one</code>), new values |
| 1530 |
are accumulated rather than overriding earlier assignments.<br> </li> |
| 1531 |
<li>When copying values to list-type tags (eg. |
| 1532 |
<code>"-keywords<filename"</code>), subsequent copies to the same tag |
| 1533 |
override earlier operations with the exception that new values may be added to |
| 1534 |
the queued list if a leading <code>+</code> is added to the target tag name (eg. |
| 1535 |
<code>"-+keywords<filename"</code>).<br> </li> |
| 1536 |
<li>Tags copied with the <code>-tagsFromFile</code> option are assigned in |
| 1537 |
order, and all together at the point in the command line where the |
| 1538 |
<code>-tagsFromFile</code> option is located, regardless of whether these tags |
| 1539 |
are specified immediately after the <code>-tagsFromFile</code> option or later |
| 1540 |
on the command line. Remember that unless otherwise specified, |
| 1541 |
"<code>-tagsFromFile @</code>" is implied before the first argument to redirect |
| 1542 |
tags (ie. <code>"-DSTTAG<SRCTAG"</code>).</li></ol> |
| 1543 |
Note: When copying tag values, adding to lists, or shifting date/time values, |
| 1544 |
the source value is always the original value found in the file, regardless of |
| 1545 |
any previous assignments. For example, the following command sets Subject to |
| 1546 |
the original value of Title in the file (NOT to "test"): |
| 1547 |
<pre>exiftool -title=test "-subject<title" a.jpg</pre></blockquote> |
| 1548 |
|
| 1549 |
<a name="Q23"></a> |
| 1550 |
<p>23a. <b>"Why do I get '<code>0 image files updated</code>' when writing?"</b>, or<br> |
| 1551 |
23b. <b>"ExifTool doesn't write some tags to a file"</b></p> |
| 1552 |
|
| 1553 |
<blockquote>There are a few reasons why this may happen: |
| 1554 |
|
| 1555 |
<ol><li>The value of the tag is not being set correctly.</li></ol> |
| 1556 |
|
| 1557 |
This may be due to a tag value which can't be converted, in which case you |
| 1558 |
should warning like this (note: you may need to use the <code>-v3</code> option |
| 1559 |
to see the warning if other same-named tags are being set properly by the same |
| 1560 |
assignment): |
| 1561 |
<pre>Warning: Can't convert IFD0:Orientation (not in PrintConv) |
| 1562 |
</pre> |
| 1563 |
You get this warning if you write an invalid value to a tag which accepts only |
| 1564 |
specific values. See the "Values" column in the appropriate table of the |
| 1565 |
<a href="TagNames/index.html">tag name documentation</a> for a list of valid |
| 1566 |
values for these types of tags. The value conversion may also be bypassed with |
| 1567 |
the <code>-n</code> option, allowing numerical values to be written directly. |
| 1568 |
See <a href="#Q6">FAQ number 6</a> for more details. |
| 1569 |
|
| 1570 |
<ol start="2"><li>The information type isn't supported by the format of the |
| 1571 |
target file.</li></ol> |
| 1572 |
|
| 1573 |
Warnings are NOT generated when a tag isn't written because it is |
| 1574 |
normal that many tags can't be written when copying between files of different |
| 1575 |
formats.</blockquote> |
| 1576 |
|
| 1577 |
<blockquote>Tags are not written if the format of the target file doesn't |
| 1578 |
support the specific type of meta information. For example, CRW images do not |
| 1579 |
support EXIF or IPTC metadata. See the |
| 1580 |
<a href="index.html#supported">Supported File Types</a> table for an indication |
| 1581 |
of the tags supported by your file. If the tags aren't supported for your file |
| 1582 |
type, then a <a href='metafiles.html'>metadata sidecar file</a> is an |
| 1583 |
alternative.</blockquote> |
| 1584 |
|
| 1585 |
<blockquote>Also note that MakerNotes tags can not be created or deleted |
| 1586 |
individually, so they can only be written if they already exist in a |
| 1587 |
file. The entire MakerNotes must be created or deleted as a block (see |
| 1588 |
<a href="#Q8">FAQ number 8</a> for details). |
| 1589 |
|
| 1590 |
<ol start="3"><li>A time value is being shifted but the specified tag doesn't |
| 1591 |
exist.</li></ol> |
| 1592 |
|
| 1593 |
For example, <code>-datetimeoriginal+=1</code> will have no effect unless |
| 1594 |
the DateTimeOriginal tag exists in the image.</blockquote> |
| 1595 |
|
| 1596 |
<a name="Q24"></a> |
| 1597 |
<p>24. <b>"When I write a file the date/time gets reset to today's date"</b></p> |
| 1598 |
|
| 1599 |
<blockquote>You should be aware of the difference between date/time values |
| 1600 |
stored in the metadata of the file itself and date/time values stored in the |
| 1601 |
filesystem (ie. in the disk directory information). A command like this may be |
| 1602 |
used to extract all date/time information with an indication of where it is |
| 1603 |
stored: |
| 1604 |
|
| 1605 |
<pre>exiftool -time:all -a -G0:1 -s c:\images\test.jpg</pre> |
| 1606 |
|
| 1607 |
and should give an output something like this: |
| 1608 |
|
| 1609 |
<pre>[File:System] FileModifyDate : 2009:10:05 20:40:36-04:00 |
| 1610 |
[File:System] FileAccessDate : 2009:10:07 09:22:12-04:00 |
| 1611 |
[File:System] FileCreateDate : 2009:10:05 20:40:36-04:00 |
| 1612 |
[EXIF:IFD0] ModifyDate : 2003:10:31 15:44:19 |
| 1613 |
[EXIF:ExifIFD] DateTimeOriginal : 2003:10:31 15:44:19 |
| 1614 |
[EXIF:ExifIFD] CreateDate : 2003:10:31 15:44:19</pre> |
| 1615 |
|
| 1616 |
The <code>-G0:1</code> option causes the family 0 and 1 group names to be |
| 1617 |
reported in square brackets for each tag. Tags labelled "<b>File:System</b>" |
| 1618 |
are "<b>pseudo</b>" tags stored in the filesystem, while the others are real |
| 1619 |
tags stored in the metadata of the file.</blockquote> |
| 1620 |
|
| 1621 |
<blockquote>ExifTool's <b>default behaviour is to set all filesystem times to |
| 1622 |
the current date/time when any "real" tag is written</b>, but the |
| 1623 |
<code>-P</code> option may be used to preserve the original FileModifyDate. |
| 1624 |
FileAccessDate represents the time the file was last accessed, and is set to the |
| 1625 |
current date/time whenever any software (including ExifTool) accesses the |
| 1626 |
file.</blockquote> |
| 1627 |
|
| 1628 |
<blockquote>On systems where a filesystem creation date is maintained, ExifTool |
| 1629 |
also sets this to the current date/time when the file is edited. On Windows the |
| 1630 |
creation date is readable/writable through the FileCreateDate tag (see the |
| 1631 |
<a href="TagNames/Extra.html">Extra Tags documentation</a>), and is preserved |
| 1632 |
with the <code>-P</code> option. On MacOS, FileCreateDate is available but |
| 1633 |
extracted only if specified explicitly, and is writable only if "setfile" is |
| 1634 |
available. The <code>-P</code> option does not preserve the creation date when |
| 1635 |
editing a file on Mac systems, but the <code>-overwrite_original_in_place</code> |
| 1636 |
option may be used to preserve all Finder information including the creation |
| 1637 |
date, or the FileCreateDate may be copied back specifically (ie. |
| 1638 |
<code>-tagsfromfile @ -FileCreateDate</code>). On Linux, the file creation date |
| 1639 |
is not stored.</blockquote> |
| 1640 |
|
| 1641 |
<blockquote>For example, commands like this act on common metadata tags, setting |
| 1642 |
the filesystem modification date/time to the current date/time: |
| 1643 |
|
| 1644 |
<pre><span class='blk'># common metadata date/time tags are incremented by 1 hour, while |
| 1645 |
# FileModifyDate is set to the current date/time</span> |
| 1646 |
exiftool -alldates+=1 c:\images</pre> |
| 1647 |
|
| 1648 |
<i class=lt>[The AllDates tag is a shortcut which represents the 3 common |
| 1649 |
metadata date/time tags: DateTimeOriginal, CreateDate and |
| 1650 |
ModifyDate.]</i></blockquote> |
| 1651 |
|
| 1652 |
<blockquote>However, FileModifyDate may be preserved with the <code>-P</code> |
| 1653 |
option: |
| 1654 |
|
| 1655 |
<pre><span class='blk'># FileModifyDate is not changed</span> |
| 1656 |
exiftool -alldates+=1 -P c:\images</pre> |
| 1657 |
|
| 1658 |
ExifTool also allows FileModifyDate to be written, which provides full control |
| 1659 |
over the filesystem modification date/time when writing: |
| 1660 |
|
| 1661 |
<pre><span class='blk'># FileModifyDate is incremented by 1 hour</span> |
| 1662 |
exiftool -alldates+=1 -filemodifydate+=1 c:\images |
| 1663 |
|
| 1664 |
<span class='blk'># FileModifyDate is set from the value of DateTimeOriginal |
| 1665 |
# (before DateTimeOriginal is incremented by 1 hour)</span> |
| 1666 |
exiftool -alldates+=1 "-filemodifydate<datetimeoriginal" c:\images |
| 1667 |
</pre></blockquote> |
| 1668 |
|
| 1669 |
<a name="Q25"></a> |
| 1670 |
<p>25. <b>"Can ExifTool be used as an image validator?"</b></p> |
| 1671 |
|
| 1672 |
<blockquote>ExifTool is not designed as an image validator but it does have a |
| 1673 |
<code>-validate</code> feature which enables extra validation checks, mainly for |
| 1674 |
JPEG and TIFF-format images (officially released in version 10.97, May 2018, |
| 1675 |
but continually being improved). Here is an example command to apply these |
| 1676 |
validation checks to a JPEG image: |
| 1677 |
|
| 1678 |
<pre>exiftool -validate -warning -error -a test.jpg</pre> |
| 1679 |
|
| 1680 |
Note there are other packages specifically designed for file validation, for |
| 1681 |
example: <a href="https://github.com/openpreserve/jhove">JHOVE</a>.</blockquote> |
| 1682 |
|
| 1683 |
<a name="Q26"></a> |
| 1684 |
<p>26. <b>"How do I import information from a database?"</b></p> |
| 1685 |
|
| 1686 |
<blockquote><i>[See <a href="#Q12">FAQ number 12</a> for help with the reverse |
| 1687 |
-- exporting metadata to a database.]</i></blockquote> |
| 1688 |
|
| 1689 |
<blockquote>ExifTool has the ability to import metadata from CSV and JSON format |
| 1690 |
database files for writing to output image files. For example, the following |
| 1691 |
commands use imported metadata to write to all image files in a directory. |
| 1692 |
|
| 1693 |
<pre><span class='blk'># import from CSV file</span> |
| 1694 |
exiftool -csv="c:\Users\Phil\test.csv" "c:\Users\Phil\Images" |
| 1695 |
|
| 1696 |
<span class='blk'># import from JSON file</span> |
| 1697 |
exiftool -json="c:\Users\Phil\test.json" "c:\Users\Phil\Images"</pre> |
| 1698 |
|
| 1699 |
For the above commands, the input CSV or JSON file must have the same format as |
| 1700 |
the output from these commands: |
| 1701 |
|
| 1702 |
<pre><span class='blk'># export to CSV file</span> |
| 1703 |
exiftool -csv "c:\Users\Phil\Images" > "c:\Users\Phil\test.csv" |
| 1704 |
|
| 1705 |
<span class='blk'># export to JSON file</span> |
| 1706 |
exiftool -json "c:\Users\Phil\Images" > "c:\Users\Phil\test.json"</pre> |
| 1707 |
|
| 1708 |
Specifically, the first row of the CSV file must contain the tag names. |
| 1709 |
The first column must be a special "SourceFile" column, containing the names of |
| 1710 |
the associated image files, with paths specified in the same way as on the |
| 1711 |
command line. The JSON file contains similar entries, but is not structured in |
| 1712 |
row/column format.</blockquote> |
| 1713 |
|
| 1714 |
<blockquote>For each image file specified on the command line, all tags for the |
| 1715 |
database entry with the corresponding SourceFile name are written (with the |
| 1716 |
exception of the FileName and Directory tags, which are ignored). A special |
| 1717 |
SourceFile name of "*" may be used to match any image file. A warning is issued |
| 1718 |
and nothing is written if a specified file does not match any SourceFile entry |
| 1719 |
in the database.</blockquote> |
| 1720 |
|
| 1721 |
<blockquote>Tag names may be prefixed by a group name to write to a specific |
| 1722 |
group (using the same format as when <code>-G</code> or <code>-G1</code> is |
| 1723 |
added to the export command). To delete a tag, set the tag value to "-" (or the |
| 1724 |
<a href="ExifTool.html#MissingTagValue">MissingTagValue</a> if this API option |
| 1725 |
was used) and use the <code>-f</code> option when importing. Tags with an empty |
| 1726 |
value are ignored in a CSV import, or set to an empty string in a JSON import |
| 1727 |
(unless <code>-f</code> is used and the |
| 1728 |
<a href="ExifTool.html#MissingTagValue">API MissingTagValue option</a> is set to |
| 1729 |
an empty string, in which case the tag is deleted).</blockquote> |
| 1730 |
|
| 1731 |
<blockquote>See the <code>-csv</code> or <code>-j</code> option in the |
| 1732 |
<a href="exiftool_pod.html#input_output_text_formatting">application documentation</a> |
| 1733 |
for more details.</blockquote> |
| 1734 |
|
| 1735 |
<a name="Q27"></a> |
| 1736 |
<p>27. <b>"My ExifTool command doesn't work from a Windows .BAT file"</b></p> |
| 1737 |
|
| 1738 |
<blockquote>In a Windows .BAT file the "<code>%</code>" character is |
| 1739 |
significant, so all "<code>%</code>" characters in ExifTool commands must be |
| 1740 |
changed to "<code>%%</code>". For example, this command line: |
| 1741 |
|
| 1742 |
<pre>exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" image.jpg</pre> |
| 1743 |
|
| 1744 |
must be changed to this in a .BAT file: |
| 1745 |
|
| 1746 |
<pre>exiftool "-FileName<CreateDate" -d "%%Y%%m%%d_%%H%%M%%S.%%%%e" image.jpg</pre> |
| 1747 |
</blockquote> |
| 1748 |
|
| 1749 |
<a name="Q28"></a> |
| 1750 |
<p>28. <b>"How do I copy a shifted date/time value?"</b></p> |
| 1751 |
|
| 1752 |
<blockquote>The <code>-TAG+=</code> and <code>-TAG-=</code> arguments always act |
| 1753 |
on the <b>existing</b> tag value, so they can not be used to shift a <b>new</b> |
| 1754 |
tag value without running a second command. For example, this is <b>wrong</b> |
| 1755 |
because the copy operation is superseded by the shift, and the result is that |
| 1756 |
the existing DateTimeOriginal is shifted back by two hours: |
| 1757 |
|
| 1758 |
<pre>exiftool "-datetimeoriginal<filemodifydate" -datetimeoriginal-=2 image.jpg <i class=blk>(WRONG!)</i> |
| 1759 |
</pre> |
| 1760 |
|
| 1761 |
The <code>-globalTimeShift</code> option fills this niche -- it shifts all |
| 1762 |
date/time tags by the specified amount when reading or copying, allowing a |
| 1763 |
shifted date/time value to be copied to another tag. So this is the proper |
| 1764 |
technique for shifting a date/time value when copying: |
| 1765 |
|
| 1766 |
<pre>exiftool "-datetimeoriginal<filemodifydate" -globaltimeshift -2 image.jpg</pre> |
| 1767 |
|
| 1768 |
An alternative is to use the ShiftTime function of the |
| 1769 |
<a href="exiftool_pod.html#Advanced-formatting-feature">advanced formatting feature</a>: |
| 1770 |
|
| 1771 |
<pre>exiftool '-datetimeoriginal<${filemodifydate;ShiftTime("-2")}' image.jpg</pre> |
| 1772 |
|
| 1773 |
(Note: Swap the single and double quotes when running this command under Windows.) |
| 1774 |
</blockquote><blockquote class=prog> |
| 1775 |
<b>Programmers</b>: Here are the equivalent ExifTool API function calls: |
| 1776 |
<pre><span class='blk'># using the GlobalTimeShift option</span> |
| 1777 |
$exiftool->Options(GlobalTimeShift => '-2'); |
| 1778 |
$exifTool->SetNewValuesFromFile($src, 'datetimeoriginal<filemodifydate'); |
| 1779 |
|
| 1780 |
<span class='blk'># using ShiftTime in an advanced formatting expression</span> |
| 1781 |
$exifTool->SetNewValuesFromFile($src, 'datetimeoriginal<${filemodifydate;ShiftTime("-2")}');</pre> |
| 1782 |
</blockquote> |
| 1783 |
|
| 1784 |
<a name="Q29"></a> |
| 1785 |
<p>29. <b>"My options don't work in a <code>-@</code> ARGFILE"</b></p> |
| 1786 |
|
| 1787 |
<blockquote>The ExifTool application has the ability to read options from an |
| 1788 |
ARGFILE using the <code>-@</code> option. The parsing of these arguments is |
| 1789 |
different from the command line. Arguments in this file are separated by |
| 1790 |
newline characters instead of spaces. Also, arguments should not be quoted. |
| 1791 |
For example, on the command line you may have: |
| 1792 |
|
| 1793 |
<pre>-d "%Y:%m:%d %H:%M:%S"</pre> |
| 1794 |
|
| 1795 |
but in an ARGFILE, this should be |
| 1796 |
|
| 1797 |
<pre>-d |
| 1798 |
%Y:%m:%d %H:%M:%S</pre></blockquote> |
| 1799 |
|
| 1800 |
<a name="Q30"></a> |
| 1801 |
<p>30. <b>"How do I extract absolutely all metadata from a file?"</b></p> |
| 1802 |
|
| 1803 |
<blockquote>By default, duplicate tags, unknown tags, embedded tags, and System |
| 1804 |
tags that require external utilities are not extracted. The main reason for |
| 1805 |
this is performance; extracting these tags will significantly increase |
| 1806 |
processing time for some files. The following command extracts everything |
| 1807 |
possible with ExifTool: |
| 1808 |
|
| 1809 |
<pre>exiftool -ee3 -U -G3:1 -api requestall=3 -api largefilesupport FILE</pre> |
| 1810 |
|
| 1811 |
(The <code>-G3:1</code> option is included in the above command only to give an |
| 1812 |
indication of where the metadata was stored.)</blockquote> |
| 1813 |
|
| 1814 |
<a name="Q31"></a> |
| 1815 |
<p>31. <b>"Why does ExifTool rewrite the entire file when I am only changing one small thing?"</b></p> |
| 1816 |
|
| 1817 |
<blockquote>Generally it is possible in theory to edit existing fixed-length tags without having to rewrite an entire file, but ExifTool doesn't do this for 3 reasons: |
| 1818 |
|
| 1819 |
<ol> |
| 1820 |
<li>The algorithm to do this would be completely different than the more general |
| 1821 |
and powerful case where you want to be able to add/delete tags and/or write |
| 1822 |
values with different lengths. Plus, implementing this feature would be a lot |
| 1823 |
of work, and it would only be useful in certain situations.</li> |
| 1824 |
<li>Some file formats (like MP4) allow metadata to be written at the beginning |
| 1825 |
or the end of a file. Writing it at the end of the file could avoid the need to |
| 1826 |
rewrite the entire starting section, but metadata is more useful at the start of |
| 1827 |
a file because then other programs (especially ones that stream the file over |
| 1828 |
the internet) don't have to read through the entire file to find the metadata. |
| 1829 |
Also, some software won't read metadata that comes at the end of a file |
| 1830 |
(probably for this reason).</li> |
| 1831 |
<li>ExifTool is designed to allow files to be read/written via pipes, which are |
| 1832 |
not seekable, so in-place editing is not possible with these files and again, |
| 1833 |
like 1, two completely different algorithms would be required.</li> |
| 1834 |
</ol></blockquote> |
| 1835 |
|
| 1836 |
<a name="Q32"></a> |
| 1837 |
<p>32. <b>"How do I safely delete all metadata from a file?"</b></p> |
| 1838 |
|
| 1839 |
<blockquote>First of all, all metadata shouldn't be removed from some file types |
| 1840 |
(such as RAW images) because this information is necessary for display of the |
| 1841 |
image. JPEG is the most popular image format and most suited to erasing all |
| 1842 |
metadata because the image and metadata are well separated in this format. |
| 1843 |
However, even with JPEG images care should be taken because the metadata |
| 1844 |
may contain color space information which should be maintained to preserve the |
| 1845 |
color rendition.</blockquote> |
| 1846 |
|
| 1847 |
<blockquote>Here is a command that may be used to safely delete all metadata |
| 1848 |
from .JPG images in a directory: |
| 1849 |
|
| 1850 |
<pre>exiftool -ext jpg -all= --icc_profile:all -tagsfromfile @ -colorspacetags DIR</pre> |
| 1851 |
|
| 1852 |
This command deletes all metadata except the ICC Profile if it exists, then |
| 1853 |
copies back any EXIF color space tags (adding any mandatory EXIF tags using |
| 1854 |
default values if necessary). |
| 1855 |
</blockquote> |
| 1856 |
|
| 1857 |
<a name="Q33"></a> |
| 1858 |
<p>33. <b>"Why do I get a '<code>No writable tags set from <file></code>' warning?"</b></p> |
| 1859 |
|
| 1860 |
<blockquote>This warning occurs when copying tags from a file if |
| 1861 |
nothing was copied (ie. if none of the specified tags were found in the |
| 1862 |
source file, or tags existed but weren't copied to any writable tags). There |
| 1863 |
are no warnings for individual tags which weren't copied; just this warning if |
| 1864 |
no tags were copied. This message may be expected for some files when using |
| 1865 |
certain commands, but may be suppressed by adding |
| 1866 |
<code>-api "NoWarning=No writable tags"</code> to the command if desired.</blockquote> |
| 1867 |
|
| 1868 |
<hr> |
| 1869 |
<i>Last revised Jan 4, 2026</i> |
| 1870 |
<p class='lf'><a href="index.html"><-- Back to ExifTool home page</a></p> |
| 1871 |
</body> |
| 1872 |
</html> |