I am getting hung up on reading EXIF data from my JPEGs. I thought it would be easy to do.
Thus far I have completed the following steps for my family's online image gallery (using C#/ASP.Net 3.5):
- Upload a ZIP file containing JPEG's (that are from my iPhone 4)
- Rename the JPEG's in the ZIP file using a preferred naming convention
- Extract the JPEG's from the ZIP file to an images folder
- Resize the images for various uses (such as thumbnails, etc.)
- Save the filename and a selected category ID to SQL Server so that I can associate the two for display purposes
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?
Update:
ExifLib looks great, but when I do the following:
double d;
ExifReader er = new ExifReader(sFileName);
er.GetTagValue<double>(ExifTags.GPSLatitude, out d);
I get this error on the last line:
Specified cast is not valid.
Any suggestions?