photokit

Apple Live Photo file format

主宰稳场 提交于 2019-11-27 18:48:47
Apple will introduce Live Photo in iOS 9/iPhone 6s. Where is the file format documented? Here's the link . Otherwise, here's the text: Live Photos Live Photos is a new feature of iOS 9 that allows users to capture and relive their favorite moments with richer context than traditional photos. When the user presses the shutter button, the Camera app captures much more content along with the regular photo, including audio and additional frames before and after the photo. When browsing through these photos, users can interact with them and play back all the captured content, making the photos come

How can I determine file size on disk of a video PHAsset in iOS8

余生颓废 提交于 2019-11-27 18:17:59
问题 I can request a video PHAsset using the Photos framework in iOS8. I'd like to know how big the file is on disk. There doesn't seem to be a property of PHAsset to determine that. Does anyone have a solution? (Using Photos framework not required) 回答1: Edit As for iOS 9.3, using requestImageDataForAsset on a video type PHAsset will result in an image, which is the first frame of the video, so it doesn't work anymore. Use the following method instead, for normal video, request option can be nil ,

Save image to photo library using photo framework

ぃ、小莉子 提交于 2019-11-27 16:12:36
问题 My app crashes every time when I try to save image using photo framework. -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ _mChangeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:[info valueForKey:UIImagePickerControllerOriginalImage]]; [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ _mChangeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:[info valueForKey

Retrieve ALAsset or PHAsset from file URL

十年热恋 提交于 2019-11-27 06:50:52
问题 Selecting images in Photos.app to pass to an action extension seems to yield paths to images on disk (e.g.: file:///var/mobile/Media/DCIM/109APPLE/IMG_9417.JPG ). Is there a way to get the corresponding ALAsset or PHAsset? The URL looks like it corresponds to the PHImageFileURLKey entry you get from calling PHImageManager.requestImageDataForAsset . I'd hate to have to iterate through all PHAssets to find it. 回答1: I did what I didn't want to do and threw this dumb search approach together. It

Which PHAssetCollection to use for saving an image?

痞子三分冷 提交于 2019-11-27 02:38:15
问题 In iOS 8's Photos.framework, I'm trying to save a UIImage to the user's photo library, much in the same way you can long-press an image in Safari and choose the "Save Image". In iOS 7, this would be by just calling ALAssetLibrary's writeImageToSavedPhotosAlbum:metadata:completionBlock . For iOS 8 we need to pick an asset collection to add a PHAsset to, but I can't figure out which PHAssetCollection is closest to just saving to the user's "camera roll" (even though there isn't one, really, in

Apple Live Photo file format

给你一囗甜甜゛ 提交于 2019-11-26 19:40:57
问题 Apple will introduce Live Photo in iOS 9/iPhone 6s. Where is the file format documented? 回答1: Here's the link. Otherwise, here's the text: Live Photos Live Photos is a new feature of iOS 9 that allows users to capture and relive their favorite moments with richer context than traditional photos. When the user presses the shutter button, the Camera app captures much more content along with the regular photo, including audio and additional frames before and after the photo. When browsing

How to get an ALAsset URL from a PHAsset?

。_饼干妹妹 提交于 2019-11-26 18:58:37
You can do it sneakily† using the undocumented PHAsset.ALAssetURL property, but I'm looking for something documented. † In Objective-C, this will help @interface PHAsset (Sneaky) @property (nonatomic, readonly) NSURL *ALAssetURL; @end holtmann Create the assetURL by leveraging the localidentifier of the PHAsset . Example: PHAsset.localidentifier returns 91B1C271-C617-49CE-A074-E391BA7F843F/L0/001 Now take the 32 first characters to build the assetURL, like: assets-library://asset/asset.JPG?id=91B1C271-C617-49CE-A074-E391BA7F843F&ext=JPG You might change the extension JPG depending on the UTI

How to get an ALAsset URL from a PHAsset?

若如初见. 提交于 2019-11-26 06:43:45
问题 You can do it sneakily† using the undocumented PHAsset.ALAssetURL property, but I\'m looking for something documented. † In Objective-C, this will help @interface PHAsset (Sneaky) @property (nonatomic, readonly) NSURL *ALAssetURL; @end 回答1: Create the assetURL by leveraging the localidentifier of the PHAsset . Example: PHAsset.localidentifier returns 91B1C271-C617-49CE-A074-E391BA7F843F/L0/001 Now take the 32 first characters to build the assetURL, like: assets-library://asset/asset.JPG?id