Swift:如何将元数据从一个UIImage复制到新的UIImage?

时间:2019-03-11 21:45:43

标签: swift uiimageview uiimage metadata

我可以从UIImage中获取元数据,我正在寻找一种将其添加到新UIImage中的方法

static func metadata(_ data: Data) -> [String : AnyObject]? {
    let options = [kCGImageSourceShouldCache as String: kCFBooleanFalse]
    if let imgSrc = CGImageSourceCreateWithData(data as CFData, options as CFDictionary), let metadata = CGImageSourceCopyPropertiesAtIndex(imgSrc, 0, options as CFDictionary) as? [String : AnyObject] {
        return metadata
    }
    return nil
}

0 个答案:

没有答案