小编use*_*554的帖子

Swift访问EXIF字典

信息:使用Swift和CGImageSourceCreateWithURL函数.

我正在尝试从URL加载文件,然后编辑包含该特定照片中所有数据的字典.

这是.swift文件中的代码.

    let url = NSURL(string: "http://jwphotographic.co.uk/Images/1.jpg")
    let imageSource = CGImageSourceCreateWithURL(url, nil)
    let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil) as Dictionary

    println(imageProperties)

    //this is an example
    let aperture = imageProperties[kCGImagePropertyGPSLatitude] as! NSNumber!

    /*
    //these are all being defined as nil
    //Load the ones from the exif data of the file
    let lensUsed = imageProperties[kCGImagePropertyExifFocalLength]
    let aperture = imageProperties[kCGImagePropertyExifApertureValue] as!
    let isoSpeed = imageProperties[kCGImagePropertyExifISOSpeedRatings] as! NSNumber
    let latitude = imageProperties[kCGImagePropertyGPSLatitude] as! NSNumber
    let longitude = imageProperties[kCGImagePropertyGPSLongitude] as! NSNumber
    let shutterSpeed = …
Run Code Online (Sandbox Code Playgroud)

exif image cgimage ios swift

7
推荐指数
2
解决办法
8774
查看次数

标签 统计

cgimage ×1

exif ×1

image ×1

ios ×1

swift ×1