-3
如何使用UIImagePickerController無需獲取UIImage元數據。不使用UIImagePickerController獲取UIImage元數據
我基本上有一個變量UIImage,我想獲取元數據。
我需要類似「myImage.date」來訪問日期的例子。
編輯1:我嘗試這一點,但它崩潰(上EXIF VAR發現無)
func getData(image: UIImage) {
guard let data = UIImageJPEGRepresentation(image, 1),
let source = CGImageSourceCreateWithData(data as CFData, nil) else { return}
let imageProperties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil)
let a = Unmanaged.passUnretained(kCGImagePropertyExifDateTimeOriginal).toOpaque()
let exif = CFDictionaryGetValue(imageProperties, a)
print(exif)
}
哪裏是你的代碼?你有什麼嘗試?什麼不工作?你做了什麼研究?爲什麼不適合你?你會得到更多更好的答案如果你證明你已經花時間去嘗試幫助你自己了。參見[Ask] –
我有我的變量UIImage,其中包含從手機拍攝的圖像,從那裏我需要獲取元數據。夥計我在網上搜索,但每個人都使用uiimagepickercontroller委託。我認爲製作視頻來證明我在google.com上的研究是無用的 – user3722523
這是您需要的嗎? http://stackoverflow.com/q/40175160/2227743 – Moritz