EXIF的标记名称?

时间:2016-10-18 07:49:07

标签: swift tags exif

我正在尝试从EXIF标记中提取数据。我能够得到日期,但有些标签似乎使用不同的标签名称:

let cgref = CGImageSourceCreateWithURL(NSURL.fileURL(withPath: polkuz) as CFURL, nil)

let imaprop2: NSDictionary = CGImageSourceCopyPropertiesAtIndex(cgref!, 0, nil)!

let exif: NSDictionary? = imaprop2["{Exif}"] as! NSDictionary?

    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "yyyy:MM:dd HH:mm:ss" 
    var pictureDate : Date

    let time0z: String? = exif!["DateTimeOriginal"] as! String?
    if time0z != nil {
        print("DateTimeOriginal = \(time0z!)")
        if let date = dateFormatter.date(from: time0z!) {
            pictureDate = date
        }
    }

// doesn't work!!!

    let model: String? = exif!["Model"] as! String?
    if model != nil {
        print("model = \(model!)")
    }
}

此代码适用于该日期。 如何获得模型,艺术家或作者等其他标签的正确拼写?

0 个答案:

没有答案