EXIF数据读写 [英] EXIF data read and write
本文介绍了EXIF数据读写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我搜索了从图片文件中获取EXIF数据,然后将其写回Swift.但是我只能找到针对不同语言的预定义库.
I searched for getting the EXIF data from picture files and write them back for Swift. But I only could find predefied libs for different languages.
我还找到了对"CFDictionaryGetValue"的引用,但是我需要哪些键来获取数据?我该怎么写呢?
I also found references to "CFDictionaryGetValue", but which keys do I need to get the data? And how can I write it back?
推荐答案
我正在使用它从图像文件中获取 EXIF信息:
I'm using this to get EXIF infos from an image file:
import ImageIO
let fileURL = theURLToTheImageFile
if let imageSource = CGImageSourceCreateWithURL(fileURL as CFURL, nil) {
let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil)
if let dict = imageProperties as? [String: Any] {
print(dict)
}
}
它为您提供了一个字典,其中包含各种信息,例如颜色配置文件-EXIF信息特别位于dict["{Exif}"]
中.
It gives you a dictionary containing various informations like the color profile - the EXIF info specifically is in dict["{Exif}"]
.
这篇关于EXIF数据读写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文