tags:

views:

1041

answers:

2

How can I read the EXIF data from an image taken with an Apple iPhone? using C#

I need the GPS related data.

ps: I know how to read EXIF except image taken with an Apple iPhone

A: 

If you load an image using:

Image image = Image.FromFile(imageName);

The EXIF values are read into the PropertyItems array on the image.

I found some code for interpreting these tags as EXIF data. I can't remember where I got it from now but I've found a copy here. I don't think that the code as it stands reads the geolocation codes, but this page claims to have a list of all EXIF tags, so you could extend this code.

Tag id 0x8825 is the GPSInfo. The GPS tags are enumerated on this page

ChrisF
thanks, but it seems that iphone don't use these tags.
zunyite
+5  A: 

I would recommend you take a look at the exiflibrary project on Google Code and its associated ExifLibrary for .NET article on Code Project.

It supports over 150 known EXIF tags including 32 GPS related ones. Getting the latitude and longitude is as easy as:

var exif = ExifFile.Read(fileName);
Console.WriteLine(exif.Properties[ExifTag.GPSLatitude]);
Console.WriteLine(exif.Properties[ExifTag.GPSLongitude]);

It even has a neat little demo application with an interactive visualization of the binary data: ExifLibrary demo

Nathan Baulch
I try the demo, but it can not read the EXIF of an image taken with an "Apple iPhone"
zunyite
I think the demo from Code Project is an older version. You should try compiling the demo app against the latest release (v0.9) from Google Code.
Nathan Baulch
v0.9 can not extract the GPS EXIF data from IPhone's image
zunyite