简体   繁体   English

如何在iOS 4.0+中从相机拍摄的照片中访问照片EXIF?

[英]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? 如何使用新的4.0 / 4.1 API从相机拍摄照片中的EXIF信息?

I use _captureStillImageAsynchronouslyFromConnection_ to take the picture and: 我使用_captureStillImageAsynchronouslyFromConnection_拍摄照片并:

[AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];

to get the jpg data but how do I extract the EXIF? 获取jpg数据,但如何提取EXIF?

The doco makes references to imageDataSampleBuffer containing EXIF (I can see it in there if I examine the variable in the console): doco引用了包含EXIF的imageDataSampleBuffer (如果我在控制台中检查变量,我可以在那里看到它):

" 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 " 缓冲区附件可能包含适合图像数据格式的元数据。例如,包含JPEG数据的缓冲区可能带有kCGImagePropertyExifDictionary作为附件

But I can't figure out how to manipulate a CMSampleBufferRef to acces it. 但我无法弄清楚如何操作CMSampleBufferRef来访问它。

Thanks. 谢谢。

The Image I/O Framework which was introduced in iOS4 allows one to read EXIF properties from a picture according to the documentation. iOS4中引入的Image I / O Framework允许用户根据文档从图片中读取EXIF属性。

Link: CGImageSource Reference - have a look at the CGImageSourceCopyPropertiesAtIndex function. 链接: CGImageSource参考 - 查看CGImageSourceCopyPropertiesAtIndex函数。

You will have to actually save the image to the Photo Library so that the EXIF data is added to the image. 您必须将图像实际保存到照片库,以便将EXIF数据添加到图像中。 After that you can use ALAssetLibrary to retrieve the image along with the EXIF info. 之后,您可以使用ALAssetLibrary检索图像以及EXIF信息。

这个图书馆可以提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM