Search code examples
c#silverlightwindows-phone-7exif

Get EXIF tags in Windows Phone 7


I would like to get all the EXIF tags of an image I took in Windows Phone 7. I have tried using ExifLib, but can't seem to get it right.

In my event handler for CaptureImageAvailable I have the following code:

JpegInfo info = ExifReader.ReadJpeg(e.ImageStream, "Pic.jpeg");
Dispatcher.BeginInvoke(delegate()
 {
      textBox1.Text = info.ExposureTime.ToString();
      textBox2.Text = info.FNumber.ToString();
                                });

e.ImageStream.Close();

Both textBox1 and textBox2 are displaying 0.

My "Cam.Capture event" is fired every 200 milliseconds. Does this have any effect on these values?

Any help would be greatly appreciated! :)


Solution

  • I think everything is ok with your code, the values just aren't set.

    Here is evidence that it's not your fault:

    • Have a look at this blog post which basically is a tutorial on reading EXIF data. There you find a screenshot of the data: many values are set but the ones you need are also 0. But I am not sure if this photo really was taken with the phone camera.

    • So I tested myself and the values are as follows; the fields you need are 0 as well:

      Artist  ""
      Copyright   null
      DateTime    "2011:11:01 20:50:07"
      Description null
      ExposureTime    0.0
      FileName    "\\Applications\\Data\\[GUID]\\Data\\PlatformData\\CameraCapture-[GUID].jpg.jpg"
      FileSize    789355
      Flash   No
      FNumber 0.0
      GpsLatitude {double[3]}
      GpsLatitudeRef  Unknown
      GpsLongitude    {double[3]}
      GpsLongitudeRef Unknown
      Height  1944
      IsColor true
      IsValid true
      LoadTime    {00:00:00.1340000}
      Make    "HTC"
      Model   "7 Trophy"
      Orientation TopRight
      ResolutionUnit  Inch
      Software    "Windows Phone 7.5"
      ThumbnailData   {byte[14913]}
      ThumbnailOffset 518
      ThumbnailSize   14913
      UserComment null
      Width   2592
      XResolution 72.0
      YResolution 72.0
      

    Looks like doing something with the EXIF every 200ms is not the cause. Out of curiosity I had a second look at the EXIF data after synching the pictures with the PC. The values are just not there. Sorry.