Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
589 views
in Technique[技术] by (71.8m points)

iphone - How to access photo EXIF in pictures taken from camera in iOS 4.0+?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...