<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>@Lathi.net: New Image Ingest Script for DNG</title>
    <link>http://blog.lathi.net/articles/2005/10/23/new-image-ingest-script-for-dng</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>On Life, Fatherhood, Christianity, and Computers</description>
    <item>
      <title>New Image Ingest Script for DNG</title>
      <description>&lt;p&gt;Now that &lt;a href="http://photoshopnews.com/2005/10/09/dng-converter-32-allows-direct-command-line-control/"&gt;Adobe&amp;#8217;s &lt;span class="caps"&gt;DNG&lt;/span&gt; Converter can be used from the command line&lt;/a&gt;, I&amp;#8217;ve written a new script to ingest photos from compact flash, convert to &lt;span class="caps"&gt;DNG&lt;/span&gt;, and rename based on &lt;span class="caps"&gt;EXIF&lt;/span&gt;.&lt;/p&gt;


	&lt;p&gt;The bad news is that the script is written in Perl and relies upon the &lt;a href="http://search.cpan.org/dist/Image-ExifTool/"&gt;Image::ExifTool&lt;/a&gt; module from &lt;span class="caps"&gt;CPAN&lt;/span&gt;.  I know there are those of you who read my blog that look down on both Perl and &lt;span class="caps"&gt;CPAN&lt;/span&gt;.  However, it&amp;#8217;s still the language I can write utility scripts in fastest.&lt;/p&gt;


	&lt;p&gt;So, here&amp;#8217;s my &amp;#8220;workflow&amp;#8221;&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Scan the CF with File::Find to get a list of all the images&lt;/li&gt;
		&lt;li&gt;Sort those images by their &amp;#8216;DateTimeOriginal&amp;#8217; from the &lt;span class="caps"&gt;EXIF&lt;/span&gt; data.&lt;/li&gt;
		&lt;li&gt;Generate a new filename based on &lt;span class="caps"&gt;YYYYMMDD&lt;/span&gt;_NNN.foo where &lt;span class="caps"&gt;NNN&lt;/span&gt; is the next serial number for that particular day.&lt;/li&gt;
		&lt;li&gt;For each image either: 1) copy the image using the new filename if it&amp;#8217;s a &lt;span class="caps"&gt;JPEG&lt;/span&gt;; or 2) run &lt;span class="caps"&gt;DNG&lt;/span&gt; Converter on it if it&amp;#8217;s &lt;span class="caps"&gt;RAW&lt;/span&gt; renaming to the new filename&lt;/li&gt;
		&lt;li&gt;&lt;span style="color:red;"&gt;&lt;span class="caps"&gt;UPDATED&lt;/span&gt;:&lt;/span&gt; Apply an Adobe &lt;span class="caps"&gt;XMP&lt;/span&gt; Template to resulting file.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;The script accepts the source directory as the first command line argument and the destination directory as the second argument.  If you&amp;#8217;re opposed to processing images during ingest, just copy from the CF to some temporary directory and ingest from there.  Also, the script uses &lt;code&gt;File::Path&lt;/code&gt; to create the destination directory if it doesn&amp;#8217;t exist.&lt;/p&gt;


	&lt;p&gt;&lt;span style="text-decoration: line-through"&gt;Ideally, I&amp;#8217;d like to be able to specify an &lt;a href="http://www.adobe.com/products/xmp/main.html"&gt;&lt;span class="caps"&gt;XMP&lt;/span&gt;&lt;/a&gt; template to apply metadata to the images as I ingest them; but I haven&amp;#8217;t gotten that far yet.  I guess &lt;code&gt;Image::ExifTool&lt;/code&gt; can write &lt;span class="caps"&gt;XMP&lt;/span&gt;.  I&amp;#8217;ll have to look into doing that.  It&amp;#8217;d save me a step or two at least.&lt;/span&gt; &lt;span style="color:red;"&gt;&lt;span class="caps"&gt;UPDATE&lt;/span&gt;:&lt;/span&gt; I talked with &lt;a href="http://www.sno.phy.queensu.ca/~phil/exiftool/"&gt;Phil Harvey, the author of ExifTool,&lt;/a&gt; today on the &lt;a href="http://www.cpanforum.com/threads/1219"&gt;&lt;span class="caps"&gt;CPAN&lt;/span&gt; Forum for Image-ExifTool&lt;/a&gt; about adding &lt;span class="caps"&gt;XMP&lt;/span&gt; metadata from a Template file.  He was kind enough to release a new exiftool v5.71 that includes this feature.  As a result, I&amp;#8217;ve added support into my &lt;code&gt;image_ingest.pl&lt;/code&gt; script.&lt;/p&gt;


	&lt;p&gt;You can &lt;a href="http://lathi.net/image_ingest.pl.txt"&gt;download image_ingest.pl here&lt;/a&gt;. ( &lt;span style="color:red;"&gt;&lt;span class="caps"&gt;UPDATED&lt;/span&gt;:&lt;/span&gt; The latest version is 1.1) There&amp;#8217;s not much configurability to the script.  The only thing you really need to configure is the path to where you&amp;#8217;ve saved Adobe&amp;#8217;s &lt;span class="caps"&gt;DNG&lt;/span&gt; Converter.  This also means that the script won&amp;#8217;t work on anything but Mac and Windows.  Odds are getting it to run on Windows will be a problem since: a) most Windows machines don&amp;#8217;t have Perl; and b) I haven&amp;#8217;t tested this at all with respect to paths and filenames.&lt;/p&gt;</description>
      <pubDate>Sun, 23 Oct 2005 20:33:07 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:fab4020924f184d06d2f0e7dfb92eafa</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2005/10/23/new-image-ingest-script-for-dng</link>
      <category>Programming</category>
      <category>Photography</category>
      <category>XMP</category>
      <category>Perl</category>
      <category>EXIF</category>
      <category>DNG</category>
    </item>
  </channel>
</rss>
