iphone - iOS 8 Photos framework. Access photo metadata -
i'm looking @ replacing alassetslibrary photos framework in app. can retrieve photos, collections, , asset sources fine (even write them out), don't see anywhere access metadata of photos (the dictionaries such {exif}, {tiff}, {gps}, etc...). alassetslibrary has way. uiimagepickercontroller has way. photos must have way too.
i see phasset has location property gps dictionary, i'm looking access of metadata includes, faces, orientation, exposure, iso, , tons more.
currently apple @ beta 2. perhaps there more apis come?
update------------------------------------------------------------------
there no official way using photos apis. can read metadata after download image data. there couple of methods using either phimagemanager or phcontenteditinginput. phcontenteditinginput method required less code , doesn't require import imageio. i've wrapped in phasset category
if request content editing input, can full image ciimage, , ciimage has property titled properties dictionary containing image metadata.
sample swift code:
let options = phcontenteditinginputrequestoptions() options.networkaccessallowed = true //download asset metadata icloud if needed asset.requestcontenteditinginputwithoptions(options) { (contenteditinginput: phcontenteditinginput?, _) -> void in let fullimage = ciimage(contentsofurl: contenteditinginput!.fullsizeimageurl) print(fullimage.properties) } sample objective-c code:
phcontenteditinginputrequestoptions *options = [[phcontenteditinginputrequestoptions alloc] init]; options.networkaccessallowed = yes; //download asset metadata icloud if needed [asset requestcontenteditinginputwithoptions:options completionhandler:^(phcontenteditinginput *contenteditinginput, nsdictionary *info) { ciimage *fullimage = [ciimage imagewithcontentsofurl:contenteditinginput.fullsizeimageurl]; nslog(@"%@", fullimage.properties.description); }]; you'll desired {exif}, {tiff}, {gps}, etc dictionaries.
Comments
Post a Comment