<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>picurl &#187; EXIF-Hacks</title>
	<atom:link href="http://www.picurl.org/blog/category/exif-hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.picurl.org/blog</link>
	<description>tagging reinvented</description>
	<lastBuildDate>Wed, 14 Jul 2010 22:24:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>pyexiv2 &#8211; the best choice for photo metadata manipulation in python</title>
		<link>http://www.picurl.org/blog/2010/04/05/pyexiv2-the-best-choice-for-photo-metadata-manipulation-in-python/</link>
		<comments>http://www.picurl.org/blog/2010/04/05/pyexiv2-the-best-choice-for-photo-metadata-manipulation-in-python/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 21:09:24 +0000</pubDate>
		<dc:creator>Franz Buchinger</dc:creator>
				<category><![CDATA[EXIF-Hacks]]></category>

		<guid isPermaLink="false">http://www.picurl.org/blog/?p=187</guid>
		<description><![CDATA[Some days ago, the python community received an early easter gift: version 0.2.0 of the image metadata library pyexiv2 was released. First of all, I want to congratulate project maintainer Olivier Tilloy and all his contributors to this important milestone. Since Geotagging, Copyright Assignment, Timestamp fixing and other image metadata manipulation techniques are commonly used [...]]]></description>
			<content:encoded><![CDATA[<p>Some days ago, the python community received an early easter gift: version 0.2.0 of the image metadata library <a href="http://tilloy.net/dev/pyexiv2/">pyexiv2</a> was released. First of all, I want to congratulate project maintainer Olivier Tilloy and all his contributors to this important milestone. Since <a href="http://en.wikipedia.org/wiki/Geotagging">Geotagging</a>, <a href="http://blogs.oreilly.com/lightroom/2008/02/copyright-and-metadata.html">Copyright Assignment</a>, <a href="http://www.macosxhints.com/article.php?story=20040324035826997">Timestamp fixing</a> and other image metadata manipulation techniques are commonly used by photographers, it is important to have free software tools in this field. </p>
<p>While there are a lot of command line tools for metadata manipulation, only a few python libraries deal with this subject. A recent Article on <a href="http://www.blog.pythonlibrary.org/2010/03/28/getting-photo-metadata-exif-using-python/">EXIF Extraction in Python</a> introduces some of them, but unfortunately doesn&#8217;t cover the newly-released pyeviv2. So I decided to spread the word about it.</p>
<h3>What is pyexiv2?</h3>
<p><a href="http://tilloy.net/dev/pyexiv2/">pyexiv2</a> is a Python binding to <a href="http://exiv2.org/">exiv2</a>, the C++ library for manipulation of EXIF, IPTC and XMP image metadata. As mentioned above, it allows you to perform many metadata manipulation tasks, such as correcting wrong photo timestamps, assigning GPS coordinates to your photos or simply dumping out the <a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format">EXIF</a> metadata generated by your camera. </p>
<h3>Why should I use pyexiv2 instead of EXIF.py or similar libs?</h3>
<ul>
<li>pyexiv2 also supports Camera RAW (.NEF, .CRW, .ORF, etc) files and even gives you access to their<a href="http://tilloy.net/dev/pyexiv2/tutorial.html#accessing-embedded-previews"> embedded preview images</a>, which allows you to perform <a href="http://www.picurl.org/blog/2009/07/18/ultra-fast-raw-to-jpeg-conversion-with-exiv2/">very fast RAW-to-JPEG conversions</a>.</li>
<li>It is able to decode <a href="http://exiv2.org/metadata.html">many important Makernote Tags</a>, such as LensTypes and ProgramModes</li>
<li>Being C++-based, pyexiv2 offers ultra-fast read and write support for metadata. In my tests, pyexiv2&#8242;s underlying library exiv2 was <a href="http://picurl.org/development/wiki/Exiv2vsExifTool">magnitudes faster than </a><a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">exiftool</a> when it came to writing metadata</li>
<li>It provides a <a href="http://tilloy.net/dev/pyexiv2/api.html">convenient Python API</a>, no need to call external tools (as with various python-to-exiftool wrappers)</li>
<li>pyexiv2 automatically converts many tag values to approbriate Python datatypes (e.g. Exif.Image.Datetime returns a Datetime object), freeing you from the parsing date strings like <code>'2004-07-13T21:23:44Z'</code>. Of course, you can also access the raw value of a tag.</li>
<li>[UPDATE]: I almost forgot to mention the most important merit of pyexiv2: it has a very robust metadata parser that is tested against <a href="http://dev.exiv2.org/repositories/browse/exiv2/trunk/test/data">hundreds of sample photos </a>from different camera models. While I appreciate the various pure-Python EXIF parsers for educational purposes, they never came close to pyexiv2&#8242;s stability.</li>
</ul>
<p></p>
<h3>What is new in version 0.2.0 ?</h3>
<p>pyexiv2 0.2.0 handles <a href="http://tilloy.net/dev/pyexiv2/api.html#module-pyexiv2.xmp">XMP metadata</a> and supports reading images from stream using the <a href="http://tilloy.net/dev/pyexiv2/api.html#module-pyexiv2.metadata">from_buffer</a> method. This means that you can provide pyexiv2 with a variable holding the image data, in prior versions, only the filepath of the image was accepted. Furthermore, pyexiv2 is now compiled against <a href="http://exiv2.org/whatsnew.html#item1">libevix2 0.19</a>, which brought huge performance improvements for reading metadata. Finally, it exposes all recent enhancements of the libexiv2 API, such as preview image access.<br />
pyexiv2 is a complete, non-backwards-compatible rewrite and features an improved, better documented API. It was compiled and tested under Linux and Windows.</p>
<h3>Installation &#038; first steps</h3>
<p>Windows folks can download the <a href="http://tilloy.net/dev/pyexiv2/download.html">.exe-Installer</a> (requires Python 2.6 or newer on your system), Linux folks have to get <a href="http://tilloy.net/dev/pyexiv2/download.html">the source code</a> and install the <a href="http://tilloy.net/dev/pyexiv2/doc/release-0.2.0/developers.html#getting-the-code">required dependencies</a> before compiling pyexiv 0.2.0. There are also <a href="http://packages.debian.org/experimental/python-pyexiv2">pre-built packages in debian experimental</a>, but these are not suitable for production environments.</p>
<p>The <a href="http://tilloy.net/dev/pyexiv2/tutorial.html">excellent introductory tutorial</a> on pyexiv2&#8242;s website will make you quickly proficient with the library.  </p>]]></content:encoded>
			<wfw:commentRss>http://www.picurl.org/blog/2010/04/05/pyexiv2-the-best-choice-for-photo-metadata-manipulation-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ThermoTagging: Evaluating the CameraTemperature</title>
		<link>http://www.picurl.org/blog/2009/10/31/thermotagging-evaluating-the-cameratemperature/</link>
		<comments>http://www.picurl.org/blog/2009/10/31/thermotagging-evaluating-the-cameratemperature/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 18:06:10 +0000</pubDate>
		<dc:creator>Franz Buchinger</dc:creator>
				<category><![CDATA[EXIF-Hacks]]></category>

		<guid isPermaLink="false">http://www.picurl.org/blog/?p=100</guid>
		<description><![CDATA[Last week, I was blogging about exiftool&#8217;s newest tag discovery, the CameraTemperature. I assumed that the CameraTemperature roughly equals the environment temperature and sketched some really exciting applications based on this idea (e.g. assigning keywords or conducting searches using this tag). Unfortunately, some open questions remained: I couldn&#8217;t evaluate my assumption, because I don&#8217;t own [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I was blogging about <a href="http://www.picurl.org/blog/2009/10/25/take-a-powershot-at-thermotagging/">exiftool&#8217;s newest tag discovery, the CameraTemperature</a>. I assumed that the CameraTemperature roughly equals the environment temperature and sketched some really exciting applications based on this idea (e.g. assigning keywords or conducting searches using this tag).</p>
<p>Unfortunately, some open questions remained: I couldn&#8217;t evaluate my assumption, because I don&#8217;t own a PowerShot. Another interesting, yet unanswered question is how quickly the CameraTemperature adapts to the environment temperature. Luckily I spend this weekend at my mother&#8217;s house and could conduct the necessary tests with her <a href="http://www.dpreview.com/reviews/specs/Canon/canon_a2000is.asp">Powershot A2000 IS</a>.</p>
<h3>My test setup</h3>
<p>My test setup was fairly simple: turn on the Powershot for 5 minutes and take a picture to my digital thermometer every 20 seconds. I planned to conduct this procedure inside my appartment (approx. 24 degrees Celsius room temperature) and outside (approx. 3 degrees Celsius). Before running my tests I allowed all devices an acclimation time of 10 minutes. I deliberately choose this period to be rather short, because I wanted to test how fast the CameraTemperature adapts to a changing environment temperature (think of quickly leaving your warm room to take some pictures of the snowman the kids have built). </p>
<p>Although the Powershot A2000 IS is just pocket size, I didn&#8217;t put it in my jacket to avoid any accidential heating by my body.</p>
<h3>Interior Test</h3>
<p>The interior test ended quite promising: I took 15 pictures, the first 7 yielded a camera temperature of 20 degrees, the other 8 of 21 degrees. My thermometer was showing constantly 23.3 degrees. Wow! This means just a difference of 2-3 degrees.</p>
<div id="attachment_108" class="wp-caption alignleft" style="width: 510px"><img src="http://www.picurl.org/blog/wp-content/uploads/2009/10/camera-temperature-outside_cropped.jpg" alt="The thermometer reports 3.7 degrees celsius, but the CameraTemperature yields 18 degrees for this picture." title="Evaluating the CameraTemperature in the exterior Test" width="500" height="231" class="size-full wp-image-108" /><p class="wp-caption-text">The thermometer reports 3.7 degrees celsius, but the CameraTemperature yields 18 degrees for this picture.</p></div>
<h3><nobr>The disappointing Exterior Test</nobr></h3>
<p>The exterior test caused more headaches (not just because of the cold October <img src='http://www.picurl.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ). Even after the acclimation period of 10 minutes, my reference thermometer was still showing the interior temperature of 23.3 degrees. When I &#8220;rebooted&#8221; it by removing the batteries, the temperature first dropped down to 8, then to 3 degrees. This was the accurate temperature according to the local weather report.</p>
<p>However, for my total 20-minutes-stay outside, the camera temperature never dropped below 17 degrees. Quite far away from the 3 degrees actual exterior temperature.</p>
<div class="wp-caption alignleft" style="width: 510px"><a href="http://spreadsheets.google.com/oimg?key=0AgCcDrYBUB7EdE5nTEJNblgwZFJPWllkQnlLSzR4cEE&#038;oid=2&#038;v=1257103752351"><img alt="previous interior temperature: 23.7 C, exterior temperature: 3.7 C" src="http://spreadsheets.google.com/oimg?key=0AgCcDrYBUB7EdE5nTEJNblgwZFJPWllkQnlLSzR4cEE&#038;oid=2&#038;v=1257103752351" title="CameraTemperature [C] acclimation over time [s]" width="400" height="300" /></a><p class="wp-caption-text">This diagram shows the slow acclimation time for the CameraTemperature. Coming from a previous interior temperature of 23.7 C, it was exposed to an exterior temperature of 3.7 C for 10 minutes. After that, numerous shots were taken at the same temperature. The points indicate the recorded CameraTemperature for each shot. After 20 minutes, the CameraTemperature just dropped to 17C</p></div>
<h3>Conclusions</h3>
<p>The results from the exterior test seem to indicate that the camera needs a long acclimation time until its temperature reachs the external temperature. In my tests, the temperature dropped by just 5 degrees in the first 20 minutes, which equals to 25% percent of the total temperature difference of 20 degrees. If we assume a linear progression, the camera needs to be <strong>exposed at least for 4*20 = 80 minutes to an environment until its temperature equals the environment temperature</strong>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.picurl.org/blog/2009/10/31/thermotagging-evaluating-the-cameratemperature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Take a (Power)Shot at ThermoTagging</title>
		<link>http://www.picurl.org/blog/2009/10/25/take-a-powershot-at-thermotagging/</link>
		<comments>http://www.picurl.org/blog/2009/10/25/take-a-powershot-at-thermotagging/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 17:12:38 +0000</pubDate>
		<dc:creator>Franz Buchinger</dc:creator>
				<category><![CDATA[EXIF-Hacks]]></category>
		<category><![CDATA[EXIF]]></category>
		<category><![CDATA[exiftool]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[IPTC]]></category>
		<category><![CDATA[picasa]]></category>
		<category><![CDATA[thermotagging]]></category>

		<guid isPermaLink="false">http://www.picurl.org/blog/?p=37</guid>
		<description><![CDATA[Phil Harvey recently published Exiftool 7.97, which comes with a well hidden, but exciting feature: it can decode the camera temperature for Canon PowerShot Models. All Canon Powershots built 2005 or later store this information in their EXIF header, albeit in a proprietary, previously unknown format. According to Phil, the camera temperature corresponds more or [...]]]></description>
			<content:encoded><![CDATA[<p>Phil Harvey recently published <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">Exiftool 7.97</a>, which comes with a well hidden, but exciting feature: it can decode the camera temperature for Canon PowerShot Models. All Canon Powershots built 2005 or later store this information in their EXIF header, albeit in a proprietary, previously unknown format.  According to Phil, the camera temperature corresponds more or less to the external temperature, if the device was exposed for a certain time to an environment. This opens interesting possibilities for image searches: you can quickly filter out pictures taken on a hot beach or during a snowball fight in winter. This article shows you how to access the camera temperature and explores the possibilities of thermo tagging.</p>
<p><strong>UPDATE:Also quite a few Canon IXUS and EOS models as well as many Pentax cams seem to write this tag. </strong> </p>
<p><div id="attachment_68" class="wp-caption alignnone" style="width: 610px"><img src="http://www.picurl.org/blog/wp-content/uploads/2009/10/thermotagging_logo.jpg" alt="filtering the temperature of your photos" title="ThermoTagging" width="600" height="160" class="size-full wp-image-68" /><p class="wp-caption-text">Hot or cold? - The CameraTemperature tag recorded by Canon Powershot cameras allows you to conduct temperature-based searches.</p></div><small>Footage (c) Flickr users <a href="http://www.flickr.com/photos/orangesmell/104131522/sizes/l/">Orangesmell</a> and <a href="http://www.flickr.com/photos/aduki/2413849339/sizes/l/">Aduki</a></small></p>
<h3>Got footage?</h3>
<p>If you don&#8217;t own a PowerShot, you can quickly download the necessary footage: Phil Harvey hosts a huge <a href="http://owl.phy.queensu.ca/~phil/exiftool/sample_images.html">&#8220;Meta Information Repository&#8221;</a>, that contains sample images from many camera manufacturers, including <a href="http://owl.phy.queensu.ca/~phil/exiftool/Canon.tar.gz">Canon</a>. Simply download the Canon Archive and extract it to your hard disk. Note: to save bandwith, the actual image has been replaced by a tiny placeholder, but the original metadata is still in place. This is fully sufficient for our experiments.</p>
<p>As I don&#8217;t own a PowerShot by myself, I also made use of the footage in the repository. If you are a PowerShot user and want to create footage by yourself, be warned: don&#8217;t expose your camera to extreme temperatures as this might rapidly shorten its life expectancy.</p>
<h3>Extracting the Camera Temperature</h3>
<p>First make sure that you &#8216;ve installed Exiftool 7.97 or newer on your system. When in doubt, simply run</p>
<p><code>exiftool -ver</code></p>
<p>from your shell or command prompt &#8211; this command displays exiftool&#8217;s version number. Then navigate to a folder containing unmodified photos taken by a Canon Powershot camera and run</p>
<p><code>exiftool -CameraTemperature -ext JPG .</code></p>
<p>and you should get a list like<br />
<code><br />
Camera Temperature              : 23 C<br />
======== CanonPowerShotSD890IS.jpg<br />
Camera Temperature              : 26 C<br />
======== CanonPowerShotSD900.jpg<br />
Camera Temperature              : 25 C<br />
======== CanonPowerShotSD950IS.jpg<br />
Camera Temperature              : 30 C<br />
</code></p>
<p>Exiftool lists the camera temperature in degrees celsius.  The <code>-ext JPG .</code> part of the command line makes exiftool look for all JPG files in the current directory, no matter if the extension is upper- or lowercase. By appending <code>-r</code> you can expand the search to subdirectories.</p>
<h3>Filtering by temperature</h3>
<p>With a bit of command-line-magic, you can also filter your photos by temperature:</p>
<p><code>exiftool -cameratemperature -if '$cameratemperature# < 20' -ext JPG .</code></p>
<p>will list all photos that were taken at a camera temperature below 20 degrees celsius, whereas </p>
<p></code><code>exiftool -cameratemperature -if '$cameratemperature# >= 20' -ext JPG .</code></p>
<p>displays a list of all photos taken at 20 degrees or more. </p>
<p>These two filtering commands deserve some explanation: the <code>-if</code> parameter tells exiftool to process only files that meet a certain condition. Also the inner part of the if clause is a bit special: <code>'$cameratemperature# < 20'</code> consists of the tag name cameratemperature (the prepended </code><code>$</code> is needed to identify a tagname within a string). The appended <code>#</code> tells exiftool to convert the tag value to a number (e.g. <code>19</code> instead of <code>'19 C'</code>). The rest of the clause is quite easy: <code>'< 20'</code> stands for "all values smaller than 20", while </code><code>&gt;=20</code> means &#8220;greater or equal to 20&#8243;.</p>
<h3>ThermoTagging hot or cool photos</h3>
<p>As exiftool <i>&#8220;decodes a riddle wrapped in a mystery inside an enigma&#8221;</i>  (quote Phil Harvey), it can extract such esoteric tags like Canon:CameraTemperature that are buried in the depths of propriertary Makernotes. Most (if not all) other Metadata readers and image management applications fail decoding this information. So it would be nice to convert the camera temperature to a format that all other applications can access. The most common way to do so is to create an IPTC Keyword for the information contained in the tag. IPTC Keywords are read by most image editors including Photoshop, many photosharing services (including flickr and picasa) auto-convert them to tags during photo upload.<br />
<img src="http://www.picurl.org/blog/wp-content/uploads/2009/10/flickr_thermotags_snippet.png" alt="Converted Thermotags at flickr.com" /><br />
<i>Converted Thermotags at flickr.com</i></p>
<p><b>Storing descriptive tags</b></p>
<p><code>exiftool -keywords+=cold -if '$cameratemperature# < 15' -ext JPG .</code></p>
<p>adds the IPTC keyword "cold" to your photo, if the camera temperature was less than 15 degrees. Just modify keyword and if-clause to tag "hot" photos <img src='http://www.picurl.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
To test your results, you can use</p>
<p></code><code><br />
exiftool -keywords -cameratemperature -if '$keywords eq "cool"' *.jpg<br />
======== CanonEOS_KissX2.jpg<br />
Keywords                        : cool<br />
Camera Temperature              : 18 C<br />
======== CanonIXY_DIGITAL20IS.jpg<br />
Keywords                        : cool<br />
Camera Temperature              : 17 C<br />
[...]<br />
</code><br />
This commands lists all photos with the keyword &#8220;cold&#8221; and extracts their keywords and Camera Temperature.</p>
<p><b>Storing precise values</b></p>
<p> If you want to store the precise degree value, you can use:</p>
<p><code>exiftool '-cameratemperature+>keywords' *.jpg</code></p>
<p>which copies the Camera Temperature value directly to an IPTC Keyword:<br />
<code><br />
exiftool -keywords CanonPowerShotSX200IS.jpg<br />
Keywords                        : cool, 18 C<br />
</code></p>
<h3>Is the camera temperature really identical with the outside temperature?</h3>
<p>Although I don&#8217;t own a Canon Powershot, I wanted to verify Phil&#8217;s assumptions on Canon&#8217;s CameraTemperature. In short, he claims that the CameraTemperature is close to the outside temperature, if the device was left in an environment for a certain time. According to him, taking a lot of images in a short time additionally heats up the camera by some degrees. While my tests can&#8217;t prove the equality of the temperatures, they indicate a strong correlation (maybe with some offset factor):</p>
<ul>
<li><b>Range of the CameraTemperature</b> exiftool dumped out values between 12 and 39 degrees celsius for Phil&#8217;s sample images. This indicates that the camera temperature is maybe a bit above the outside temperature (why are there no pics with values less than 10 degrees?) </li>
<li><b>Correlation of creation date and CameraTemperature</b> When I compared the temperature with the creation date (Exif:DateTimeOriginal), it turned out that all photos with value less than 20 degrees were taken in autumn or winter </li>
<li><b>Visual correlation</b> I extracted a few thumbnails from the &#8220;hottest&#8221; (> 35) degrees and coldest (< 15 degrees) values) and tried to find visual hints for heat or coldness (e.g. snow, summer clothes etc). My verdict is that there are no contradictory elements, but you can judge for yourself by looking at the <a href="http://www.picurl.org/blog/wp-content/uploads/2009/10/thumbnails_hot.png">hottest or the <a href="http://www.picurl.org/blog/wp-content/uploads/2009/10/cool_thumbnails.png">coldest</a> thumbnails.</li>
</ul>
<p><b>Acknowledgements</b><br />
I want to thank Phil Harvey for developing <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">Exiftool</a> and his suggestions on this article. Vesa Kivisto also deserves a honorary mention for the decoding of the CameraTemperature tag.</p>]]></content:encoded>
			<wfw:commentRss>http://www.picurl.org/blog/2009/10/25/take-a-powershot-at-thermotagging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Shutter Count &#8211; the mileage indicator for your DSLR</title>
		<link>http://www.picurl.org/blog/2009/07/25/shutter-count-the-mileage-indicator-for-your-dslr/</link>
		<comments>http://www.picurl.org/blog/2009/07/25/shutter-count-the-mileage-indicator-for-your-dslr/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 17:15:12 +0000</pubDate>
		<dc:creator>Franz Buchinger</dc:creator>
				<category><![CDATA[EXIF-Hacks]]></category>
		<category><![CDATA[Canon]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[EXIF]]></category>
		<category><![CDATA[exiftool]]></category>
		<category><![CDATA[Firmware]]></category>
		<category><![CDATA[Nikon]]></category>
		<category><![CDATA[Olympus]]></category>
		<category><![CDATA[Pentax]]></category>
		<category><![CDATA[shutter]]></category>

		<guid isPermaLink="false">http://www.picurl.org/blog/?p=8</guid>
		<description><![CDATA[So you are about to buy a used DSLR cam from eBay. The model isn&#8217;t top-notch, but still solid quality and was released 2 years ago. The pictures on the auction page of the cam look good, but was the camera really rarely used as stated in the auction text? Or are you making your [...]]]></description>
			<content:encoded><![CDATA[<p>So you are about to buy a used <a href="http://en.wikipedia.org/wiki/Dslr">DSLR</a> cam from eBay. The model isn&#8217;t top-notch, but still solid quality and was released 2 years ago. The pictures on the auction page of the cam look good, but was the camera really rarely used as stated in the auction text? Or are you making your bid for an over-used device that already suffers from abrasion &#8220;diseases&#8221; like wobbly buttons?</p>
<h3>Estimating the &#8220;true age&#8221; of a camera</h3>
<p>The date of purchase isn&#8217;t a very reliable indicator, as the usage intensity of cameras can vary greatly. A 2-year-old DSLR that is mainly used at holidays or family events is surely in a better condition than one that serves as bi-weekly-party snapshot device.</p>
<p>It would be nice to have something like a mileage indicator for DSLRs, that more or less counts every picture ever taken with a particular cam. Luckily, such a magic indicator already exists, although its information isn&#8217;t always easy to obtain: The Shutter Count measures the number of shutter releases during the lifetime of your camera. A <a href="http://en.wikipedia.org/wiki/Shutter_(photography)">shutter</a> is a moveable device, that exposes the camera sensor to the light during the shooting of the picture. Roughly spoken, the number of shutter releases approximately corresponds to the number of pictures taken with your camera.</p>
<h3>Accessing the Shutter Count with exiftool</h3>
<p>Unfortunately, the Shutter Count isn&#8217;t very easy to access. Only a few DSLR models from <a href="http://public.robo47.net/kamera-ausloesungen-aus-original-bild-auslesen.php#faq-welche-kameras-werden-unterstuetzt">Nikon, Canon, Pentax and Samsung</a> (green model names) dump this information out with their EXIF metadata. If you intend to buy such a camera, you can ask the seller to mail you an unmodified photo directly taken from the camera.<br />
<img src="http://www.picurl.org/blog/wp-content/uploads/2009/07/shutter-count-online_cropped.png" alt="Jeffrey Friedl&#039;s Exif Viewer reports the Shutter count" title="Jeffrey Friedl&#039;s Exif Viewer reports the Shutter count" width="459" height="288" class="alignnone size-full wp-image-24" /><br />
<em>Jeffrey Friedl&#039;s Exif Viewer reports the Shutter count</em></p>
<p>You can then either upload the photo to <a href="http://regex.info/exif.cgi/exif.cgi">Jeffrey Friedl&#8217;s Exif viewer</a> or install the famous <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">ExifTool metadata extractor</a> on your system (Win/Mac/Linux). Open a shell/console, navigate to the directory where you stored the photo and type<br />
<code><br />
exiftool THE_UNMODIFIED_IMAGE.JPG | find "Shutter Count"<br />
</code> on Windows or</p>
<p><code><br />
exiftool THE_UNMODIFIED_IMAGE.JPG | grep Shutter Count<br />
</code> on Linux or Mac OS.</p>
<p>If a line like<br />
<code>Shutter Count:      2391</code> </p>
<p>appears at your command prompt, your attempt was successful. If nothing appears, your model likely doesn&#8217;t include the shutter count in its metadata. NOTE: Only a few EXIF viewers will extract the Shutter Count value, as it is stored in the so-called Makernotes (proprietary extensions of the EXIF standard). To get reliable results, please use the tools I mentioned above.</p>
<h3>The Firmware way</h3>
<p><div id="attachment_26" class="wp-caption alignnone" style="width: 260px"><img src="http://www.picurl.org/blog/wp-content/uploads/2009/07/shutter-count-olympus-e500.jpg" alt="This Olympus E-500 has a Shutter Count value of 2265 (screenshot of cam display, yellow highlighted)" title="Shutter Count of an Olympus E-500 (screenshot of cam display, yellow highlighted)" width="250" height="185" class="size-full wp-image-26" /><p class="wp-caption-text">This Olympus E-500 has a Shutter Count value of 2265 (screenshot of cam display, yellow highlighted)</p></div><br />
Anyway, there is still hope: a few Models, such as the popular <a href="http://www.olympus.co.uk/consumer/dslr_6760.htm">Olympus E-Series</a> cameras, allow you to access the shutter count by sniffing the camera&#8217;s firmware. The downside: you need physical access to the camera and some patience (or a reliable AND skilled person that does this for you). <a href="http://www.biofos.com/cornucop/hidden.html">This guide</a> shows you how to display the shutter count value on the screen of your Olympus E-Series camera. </p>
<h3>Interpreting the numbers</h3>
<p>You had a hard time to retrieve the shutter count, but what does the value mean? Is the cam still a teenager or already almost in heaven? Oleg Kikin maintains a <a href="http://www.olegkikin.com/shutterlife/">Shutter Count life expectancy database</a>. Users report their shutter count numbers and whether the cam is still alive or already trash.<br />
<div id="attachment_25" class="wp-caption alignnone" style="width: 540px"><img src="http://www.picurl.org/blog/wp-content/uploads/2009/07/shutter-count-nikon-d70.png" alt="Life expectancy of a Nikon D70 based on the shutter count value" title="shutter-count-nikon-d70" width="530" height="426" class="size-full wp-image-25" /><p class="wp-caption-text">Life expectancy of a Nikon D70 based on the shutter count value (clicks). Only 37% of all models with more than 100.000 pictures are still working. </p></div><br />
While these numbers can give you some orientation, don&#8217;t forget to consider that a lot of factors impact the live expectancy of a DSLR: outdoor usage, storage or maintainance intervals. You should also be aware of the fact that shutter counts are not immutable. EXIF-based shutter counts can be manipulated quite easily, but also the firmware values aren&#8217;t immune: firmware upgrades or repairs may alter the shutter count.</p>]]></content:encoded>
			<wfw:commentRss>http://www.picurl.org/blog/2009/07/25/shutter-count-the-mileage-indicator-for-your-dslr/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ultra-fast RAW to JPEG conversion with exiv2</title>
		<link>http://www.picurl.org/blog/2009/07/18/ultra-fast-raw-to-jpeg-conversion-with-exiv2/</link>
		<comments>http://www.picurl.org/blog/2009/07/18/ultra-fast-raw-to-jpeg-conversion-with-exiv2/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 12:45:10 +0000</pubDate>
		<dc:creator>Franz Buchinger</dc:creator>
				<category><![CDATA[EXIF-Hacks]]></category>

		<guid isPermaLink="false">http://www.picurl.org/blog/?p=7</guid>
		<description><![CDATA[Finally you escaped from your dusty appartment and spent a wonderful day shooting photos in the wild with your brand-new SLR. To capture all the magnificient details of nature, you decided to shoot in Camera RAW, and not in crumpy-old JPEG format. While waiting for the train home, you quickly want to upload the best [...]]]></description>
			<content:encoded><![CDATA[<p>Finally you escaped from your dusty appartment and spent a wonderful day shooting photos in the wild with your brand-new SLR. To capture all the magnificient details of nature, you decided to shoot in <a href="http://en.wikipedia.org/wiki/Raw_image_format">Camera RAW</a>, and not in crumpy-old <a href="http://en.wikipedia.org/wiki/Jpeg">JPEG format</a>. While waiting for the train home, you quickly want to upload the best shots to your <a href="http://www.flickr.com">flickr</a> account. Since each RAW photo has a filesize of 10 Megabytes, this isn&#8217;t the most bandwith-friendly uploading format.  Furthermore, your tiny netbook offers only little CPU horsepower. So you are desparately looking for an easy and performant way to convert dozens of RAW photos back to JPEG.</p>
<h3>Imagemagick to the rescue?</h3>
<p>When it comes to batch-file processing, <a href="http://imagemagick.org/script/index.php">Imagemagick</a> is often the obvious choice. No nagging dialogs or splash screens, just a pure and simple command line interface.<br />
In fact, converting a bunch of Camera RAW files to JPEG is as simple as typing:<br />
<code><br />
mogrify -format jpg *.*<br />
</code><br />
in a shell/console window (of course you need to cd to your RAW photo directory before). Unfortunately, this simple approach has some downsides:</p>
<ul>
<li>Imagemagick depends on<a href="http://ufraw.sourceforge.net/"> UFRaw</a> to be able to process RAW photos. If this package is not installed, Imagemagick exists with a rather cryptic error message.</li>
<li>On my quite up-to-date laptop (Intel Core2 Duo T9300, 3 GB Ram, Ubuntu 9.04, ImageMagick 6.5.0-2), the conversion process took 65 seconds for 7 RAW files under almost 100% CPU load. That&#8217;s 10 seconds per RAW Photo. But for a low-end-netbook, you might have to multiply these numbers by 4 or 5, since the CPU/memory is much weaker.</li>
</ul>
<p>So, waiting 40 seconds for one photo to convert is not your preferred choice?</p>
<h3>Why so slow?</h3>
<p>Don&#8217;t blame Imagemagick for its poor performance. Converting RAW photos to other formats is actually a computationally intensive task, since the RAW format doesn&#8217;t store ready-to-display pixel/color-channel data, but just the information captured by the photo sensor of the camera.  You can think of it as some sort of &#8220;digital negative&#8221; that needs a huge amount of processing, before it becomes a viewable image. The benefit of this &#8220;raw&#8221; approach is that you can massively influence the development process. With JPEG coming out of your camera, the possibilities are much more limited. </p>
<h3>Speeding up the conversion</h3>
<p>But back to our problem. If the conversion process is that CPU/memory-hungry, how can we improve it?<br />
The answer is easy: by circumvention. If we look closer at the <a href="http://en.wikipedia.org/wiki/Raw_image_format#File_contents">contents of a RAW image file</a>, we find </p>
<blockquote><p>&#8220;[..] optionally a reduced-size image in JPEG format which can be used for a quick and less computing-intensive preview[..].&#8221;</p></blockquote>
<p>Luckily, &#8220;optionally&#8221; means de-facto-standard, since the RAW image formats of Nikon, Canon, Olympus, Pentax and many other manufacturers support this feature.<br />
So we don&#8217;t need to compute the JPEG representation of our RAW file, we can simply &#8220;snip out&#8221; an already embedded JPEG from the RAW file. We? Let&#8217;s delegate this to a specialized program.</p>
<h3>Almost-realtime-&#8221;conversion&#8221; with exiv2</h3>
<p>Since version 0.18, the excellent<a href="http://exiv2.org/"> exiv2 utility</a> can not only extract EXIF/IPTC information from an image, but also dump out embedded JPEG preview files from RAW photos.<br />
The workflow is straightforward: Open a shell/console window and <a href="http://en.wikipedia.org/wiki/Cd_(command)">cd</a> to your RAW photo directory.<br />
First we need to find out, which previews are embedded in our RAW file:<br />
<code><br />
exiv2 -pp RAW_CANON_350D.CR2<br />
</code><br />
exiv2&#8242;s response tells us that there are 2 embeded preview images, one thumbnail with 160&#215;120 pixels, and a larger preview with 1536&#215;1024 pixels:<br />
<code><br />
Preview 1: image/jpeg, 160x120 pixels, 5164 bytes<br />
Preview 2: image/jpeg, 1536x1024 pixels, 151637 bytes<br />
</code><br />
Preview #2 is just fine for our purpose (uploading to flickr), so we extract it with<br />
<code><br />
exiv2 -ep2 RAW_CANON_350D.CR2<br />
</code><br />
which creates a file called RAW_CANON_350D-preview2.jpg in the current directory. The option &#8216;-ep2&#8242; simply means &#8220;extract preview #2&#8243;. To batch-process all our RAW files in the current directory we can type:<br />
<code><br />
exiv2 -ep2 *.CR2<br />
</code><br />
because all RAW files from one camera manufacturer have the same preview image structure. Don&#8217;t forget to adapt the file extension to the one of your manufacturer, e.g. *.ORF for Olympus, *.NEF for Nikon.<br />
If you want to extract the preview images to some other directory, the exiv2&#8242;s &#8216;-l&#8217; option is perfect:<br />
<code><br />
exiv2 -ep2 -l previews *.CR2<br />
</code><br />
would extract the JPEGs to the already existing subdirectory &#8216;previews&#8217;.</p>
<h3>Downsides</h3>
<p>exiv2&#8242;s extraction approach is ultra-fast, but has the downside that its limited to the embedded previews of the RAW file. You can&#8217;t generate JPEG dumps of an arbitrary size using exiv2. However it is possible to process the extracted previews with Imagemagick (e.g. to scale them down further, apply better compression). Furthermore you have to dispense with the power of RAW processing. However, our described method is just right when you need a quick conversion and/or only have limited CPU horsepower.</p>]]></content:encoded>
			<wfw:commentRss>http://www.picurl.org/blog/2009/07/18/ultra-fast-raw-to-jpeg-conversion-with-exiv2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
