xcode 从 Cocoa 中的图像读取 EXIF/IPTC 信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9141637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Read EXIF/IPTC information from image in Cocoa
提问by Laurent Crivello
I am unable to find any recent example on how to read EXIF/IPTC information from an image in Cocoa. Is there anything that can be easily done or should I use an external tool as exiftool and start it with NSTask ?
我找不到关于如何从 Cocoa 中的图像读取 EXIF/IPTC 信息的任何最新示例。有什么可以轻松完成的事情,还是应该使用外部工具作为 exiftool 并使用 NSTask 启动它?
Thanks !
谢谢 !
回答by Caleb
There's some code that appears useful here: http://devmacosx.blogspot.com/2011/07/nsimage-exif-metadata.html
这里有一些有用的代码:http: //devmacosx.blogspot.com/2011/07/nsimage-exif-metadata.html
回答by Adam Wright
You can use the Image Source functionsfrom the Image IO library. Something like...
您可以使用Image IO 库中的Image Source 函数。就像是...
CGImageSourceCreateWithData(someCFDataRef, nil);
CFDictionaryRef dictRef = CGImageSourceCopyPropertiesAtIndex(imgSource, 0, nil);
should fill dictRef
with the EXIF data.
应填写dictRef
EXIF 数据。