4

How do I access the EXIF info in a picture from the camera taken using the new 4.0/4.1 APIs?

I use _captureStillImageAsynchronouslyFromConnection_ to take the picture and:

[AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];

to get the jpg data but how do I extract the EXIF?

The doco makes references to imageDataSampleBuffer containing EXIF (I can see it in there if I examine the variable in the console):

"The buffer attachments may contain metadata appropriate to the image data format. For example, a buffer containing JPEG data may carry a kCGImagePropertyExifDictionary as an attachment"

But I can't figure out how to manipulate a CMSampleBufferRef to acces it.

Thanks.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Shizam
  • 9,627
  • 8
  • 51
  • 82

3 Answers3

5

The Image I/O Framework which was introduced in iOS4 allows one to read EXIF properties from a picture according to the documentation.

Link: CGImageSource Reference - have a look at the CGImageSourceCopyPropertiesAtIndex function.

ynnckcmprnl
  • 4,382
  • 1
  • 24
  • 25
0

You will have to actually save the image to the Photo Library so that the EXIF data is added to the image. After that you can use ALAssetLibrary to retrieve the image along with the EXIF info.

ATOzTOA
  • 34,814
  • 22
  • 96
  • 117
  • 1
    Nah, you can use the Image I/O Framework as Yannick mentions, no need to save it to the library. – Shizam Dec 13 '12 at 18:30
0

This library could be of assistance.

Strelok
  • 50,229
  • 9
  • 102
  • 115
  • 1
    Correct, that library could be used but now that Apple supports EXIF natively I'd rather use native APIs to do it. – Shizam Sep 09 '10 at 16:33