Get EXIF Data from Image in Swift

From PeformIQ Upgrade
Revision as of 21:53, 16 October 2021 by PeterHarding (talk | contribs) (Created page with " This seems to work: <pre> import ImageIO ... func getExif(_ uRLToTheImageFile: URL) { if let imageSource = CGImageSourceCreateWithURL(fileURL as CFURL, nil) { l...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This seems to work:


import ImageIO
...

func getExif(_ uRLToTheImageFile: URL)
{
    if let imageSource = CGImageSourceCreateWithURL(fileURL as CFURL, nil) {
        let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil)
        if let dict = imageProperties as? [String: Any] {
            print(dict)
        }
    }
}

From - http://stackoverflow.com/questions/40175160/exif-data-read-and-write