title: Extracting EXIF from JPEG
body: <p>I am getting hung up on reading EXIF data from my JPEGs. I thought it would be easy to do.</p>
  
  <p>Thus far I have completed the following steps for my family's online image gallery (using C#/ASP.Net 3.5):</p>
  
  <ol>
  <li>Upload a ZIP file containing JPEG's (that are from my iPhone 4)</li>
  <li>Rename the JPEG's in the ZIP file using a preferred naming convention</li>
  <li>Extract the JPEG's from the ZIP file to an images folder</li>
  <li>Resize the images for various uses (such as thumbnails, etc.)</li>
  <li>Save the filename and a selected category ID  to SQL Server so that I can associate the two for display purposes</li>
  </ol>
  
  <p>I would like to extract the latitude and longitude from the original JPEG image and then insert those values into my database in the same proc that inserts the filename and category ID (step # 5). I need these values to work with the Google Maps API. What is the simplest way to do it?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>ExifLib looks great, but when I do the following: </p>
  
  <pre><code>double d; 
  ExifReader er = new ExifReader(sFileName); 
  er.GetTagValue&lt;double&gt;(ExifTags.GPSLatitude, out d); 
  </code></pre>
  
  <p>I get this error on the last line: </p>
  
  <blockquote>
    <p>Specified cast is not valid. </p>
  </blockquote>
  
  <p>Any suggestions?</p>