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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:12:38  来源:igfitidea点击:

Read EXIF/IPTC information from image in Cocoa

xcodemacoscocoaexifiptc

提问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

回答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 dictRefwith the EXIF data.

应填写dictRefEXIF 数据。