| 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>Under the Hood</title> |
| 6 | <link rel=stylesheet type='text/css' href='style.css' title='Style'> |
| 7 | <style type="text/css"> |
| 8 | <!-- |
| 9 | pre { margin: 0 } |
| 10 | ol.index { margin: 0; padding: 0 0 0 2em } |
| 11 | --> |
| 12 | </style> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div class='index'> |
| 16 | <a href="#overview">Overview</a> |
| 17 | <br><a href="#conversions">Value Conversions</a> |
| 18 | <br><a href="#philophies">Underlying Philosophies</a> |
| 19 | <br><a href="#perl">Why Perl?</a> |
| 20 | </div> |
| 21 | |
| 22 | <h1 class='up'>"Under the Hood" of ExifTool</h1> |
| 23 | |
| 24 | <p>This page explains some details of ExifTool's inner workings.</p> |
| 25 | |
| 26 | <a name="overview"></a> |
| 27 | <h2>Overview of ExifTool</h2> |
| 28 | |
| 29 | <p>Below is a diagram showing the flow of information for the exiftool |
| 30 | application. Indicated outside the boxes on the diagram are some command-line |
| 31 | options associated with the various stages of processing. All of these options |
| 32 | are directly associated with options or function calls available via the API |
| 33 | (Application Programming Interface), with the exception of the output text |
| 34 | formatting which is handled at the application level.</p> |
| 35 | |
| 36 | <center><img src="overview.png" alt="ExifTool Overview" width="680" height="460"></center> |
| 37 | |
| 38 | <p>The information flow is separated into two distinct modes: 1) |
| 39 | <span class=blu>Reading or extracting information</span>, and 2) |
| 40 | <span class=red>Writing or editing</span>. The application runs in |
| 41 | <b class=blu>read</b> mode by default, but switches to <b class=red>write</b> mode |
| 42 | if a new value is assigned to any tag (via "<code>-TAG=</code>", |
| 43 | "<code>-tagsFromFile</code>", "<code>-geotag</code>", "<code>-csv=</code>" or |
| 44 | "<code>-json=</code>" on the command line).</p> |
| 45 | |
| 46 | <a name="conversions"></a> |
| 47 | <h2>Value Conversions</h2> |
| 48 | <p>When ExifTool reads or writes the value of a tag, there are 3 separate |
| 49 | conversions applied to each value, resulting in 4 different levels for the value |
| 50 | of each tag. By default, users interact only with the human-readable |
| 51 | ("<b>PrintConv</b>") value, but other levels are exposed through various exiftool |
| 52 | options:</p> |
| 53 | |
| 54 | <ol start=3><li>The "<b>PrintConv</b>" value is the final human-readable value |
| 55 | which has been converted for display. Often, the "PrintConv" conversion will |
| 56 | translate numbers into words for better readability. The <code>-lang</code> |
| 57 | (Lang) option is used to specify the language for this conversion, and the |
| 58 | <code>-c</code> and <code>-d</code> (CoordFormat and DateFormat) options specify |
| 59 | this formatting for GPS coordinates and date/time values.</li></ol> |
| 60 | |
| 61 | <ol start=2><li>For numerical values, the "<b>ValueConv</b>" value is a |
| 62 | machine-readable value suitable for use in calculations, typically converted to |
| 63 | standard units (eg. degrees, meters, or seconds). For date/time values the |
| 64 | standard EXIF date/time format is used ("YYYY:mm:dd HH:MM:SS" plus decimal |
| 65 | seconds and time zone if they exist). For tags which are a closed choice of |
| 66 | string, this is the stored value of the string. The ValueConv value is |
| 67 | returned for all tags when the <code>-n</code> option is used, or for individual |
| 68 | tags by suffixing the tag name with a <code>#</code> character.</li></ol> |
| 69 | |
| 70 | <ol start=1><li>The "<b>Raw</b>" value is the value after initial formatting is |
| 71 | applied to the binary data from the file. Most tags have no separate "ValueConv" |
| 72 | conversion, so for these tags the "Raw" value is the same as the "ValueConv" |
| 73 | value. Values stored in rational form also have a "<b>Rational</b>" value. Both |
| 74 | Raw and Rational values may be seen by using the <code>-v</code> option.</li></ol> |
| 75 | |
| 76 | <ol start=0><li>The "<b>Binary</b>" value is the actual binary data stored in the |
| 77 | file. This data is displayed in hexadecimal form with the <code>-v3</code> |
| 78 | option, or by using the <code>-htmlDump</code> feature. Note that this value is |
| 79 | not related to the <code>-b</code> (<code>-binary</code>) option, which actually |
| 80 | returns the "ValueConv" value and is used for tags where this value can not be |
| 81 | presented in a simple text format. The Writable column in the |
| 82 | <a href="TagNames/index.html">Tag Name documentation</a> |
| 83 | gives the format of this binary data for writable tags.</li></ol> |
| 84 | |
| 85 | <p>Below are some examples of these different values for a few tags:</p> |
| 86 | |
| 87 | <blockquote><table class=norm> |
| 88 | <tr><th>Tag</th><th>3. PrintConv</th><th>2. ValueConv</th><th>1. Raw (Rational)</th><th>0. Binary</th></tr> |
| 89 | <tr align='center'><td>EXIF:Orientation</td><td>Horizontal (normal)</td><td>1</td><td>1</td><td><pre>00 01</pre></td></tr> |
| 90 | <tr align='center'><td>EXIF:GPSLatitude</td><td>45 deg 20' 11.00"</td><td>45.3363888888889</td><td>45 20 11<br>(45/1 20/1 11/1)</td> |
| 91 | <td><pre>00 00 00 2d 00 00 00 01<br>00 00 00 14 00 00 00 01<br>00 00 00 0b 00 00 00 01</pre></td></tr> |
| 92 | <tr align='center'><td>XMP:GPSLatitude</td><td>45 deg 20' 11.00"</td><td>45.3363888888889</td><td>45,20.183333N</td> |
| 93 | <td>"45,20.183333N"</td></tr> |
| 94 | <tr align='center'><td>EXIF:ExposureTime</td><td>1/30</td><td>0.03333333333</td><td>0.03333333333<br>(1/30)</td> |
| 95 | <td><pre>00 00 00 01 00 00 00 1e</pre></td></tr> |
| 96 | <tr align='center'><td>EXIF:ShutterSpeedValue</td><td>1/30</td><td>0.0333333334629176</td><td>4.90689059<br>(19868/4049)</td> |
| 97 | <td><pre>00 00 4d 9c 00 00 0f d1</pre></td></tr> |
| 98 | <tr align='center'><td>EXIF:ModifyDate</td><td>(set by <code>-d</code> option)</td><td>2016:11:25 11:56:39</td><td>2016:11:25 11:56:39</td> |
| 99 | <td>"2016:11:25 11:56:39\0"</td></tr> |
| 100 | <tr align='center'><td>XMP:ModifyDate</td><td>(set by <code>-d</code> option)</td><td>2016:11:25 11:56:39.00-05:00</td><td>2016-11-25T11:56:39.00-05:00</td> |
| 101 | <td>"2016-11-25T11:56:39.00-05:00"</td></tr> |
| 102 | </table></blockquote> |
| 103 | |
| 104 | <a name="philophies"></a> |
| 105 | <h2>Underlying Philosophies</h2> |
| 106 | |
| 107 | <p>You have the right to know about the metadata contained in your images. A main |
| 108 | goal of the Exiftool project is to make this information freely available, both to |
| 109 | the general public and as a resource for other developers.</p> |
| 110 | |
| 111 | <p>In the design of exiftool, there have been a number of underlying philosophies |
| 112 | which have helped to influence the overall development:</p> |
| 113 | |
| 114 | <ol> |
| 115 | <li>Make <a href="ExifTool.html">Image::ExifTool</a> as independent as possible |
| 116 | from other libraries to make it portable and easy to install. (Portable to |
| 117 | a wide range of systems and Perl versions.)</li> |
| 118 | <li>Keep the interface simple for simple tasks (sometimes at the expense of making |
| 119 | it more complicated for complex tasks).</li> |
| 120 | <li>The <a href="ExifTool.html#Methods">API functions</a> should be isolated from |
| 121 | the details of the metadata formats (otherwise the interface turns into a giant |
| 122 | hairball, like the metadata).</li> |
| 123 | <li>Maintain flexibility to allow users the freedom to do what they want |
| 124 | (eg. support user-defined tags).</li> |
| 125 | <li>Design the code to be efficient for batch processing, even if it increases the |
| 126 | initial overhead.</li> |
| 127 | <li>When writing files, remember 3 things: 1) data integrity, 2) data integrity, and |
| 128 | 3) data integrity. If you can't do it right, don't do it at all.</li> |
| 129 | <li>If possible, recognize file types by their structure, not by their extension.</li> |
| 130 | <li>Maintain backward compatibility when making changes to the ExifTool API or |
| 131 | command line application.</li> |
| 132 | </ol> |
| 133 | |
| 134 | <a name="perl"></a> |
| 135 | <h2>Why Write ExifTool in Perl?</h2> |
| 136 | |
| 137 | <p>At the start of ExifTool development, Perl, Python and C++ were all considered as |
| 138 | possible languages for the project. It was recognized that the project would require |
| 139 | considerable effort, and the choice of language could heavily influence the amount of |
| 140 | work necessary. Python was a strong contender, but was discounted due to a personal |
| 141 | preference for C-like syntax. Perl was chosen over C++ for the main reason that |
| 142 | it would be less work to develop and support the project. Looking back, this was |
| 143 | definitely the right choice, and there was the added benefit of a strong |
| 144 | infrastructure in support of |
| 145 | <a href="http://www.cpantesters.org/distro/I/Image-ExifTool.html">testing</a> and |
| 146 | <a href="https://metacpan.org/release/Image-ExifTool">distributing</a> Perl software.</p> |
| 147 | |
| 148 | <p>Perl 5 is very mature and extremely stable, so there is almost zero time wasted |
| 149 | dealing with compilation issues. Compare this to C++, where a majority of |
| 150 | development time for a large project may be spent in this area. Also, Perl's |
| 151 | built-in regular expressions are fantastically useful for all of the string |
| 152 | manipulations necessary for a metadata library. The biggest problem with Perl is |
| 153 | its lack of support for Windows Unicode file names.</p> |
| 154 | |
| 155 | <p>The bottom line is that most of the development time is spent dealing with the |
| 156 | mechanics of metadata, with the result that ExifTool is full-featured metadata |
| 157 | library. With one main developer (Phil Harvey) and 300 thousand lines of code (as of |
| 158 | Dec 2025), this is a real accomplishment.</p> |
| 159 | |
| 160 | <hr> |
| 161 | <i>Created Jun 24, 2009</i><br> |
| 162 | <i>Last revised Dec 9, 2025</i> |
| 163 | <p class='lf'><a href="index.html"><-- Back to ExifTool home page</a></p> |
| 164 | </body> |
| 165 | </html> |