How to extract image from a live photo?

我的梦境 提交于 2019-12-07 22:24:09

问题


I know how to extract video from a live photo. Explained here.

Use the PHAssetResourceManager to get the video file from the PHAssetResource.

PHAssetResourceManager.defaultManager().writeDataForAssetResource(assetRes, 
    toFile: fileURL, options: nil, completionHandler: 
  {
     // Video file has been written to path specified via fileURL
  }

But how to extract image URL from PHLivePhoto. The motivation behind this is to get both video and image URL in order to upload it to the server.


回答1:


Well assuming you have access to the PHAsset you can do something like the following:

[asset requestContentEditingInputWithOptions:nil
                           completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
      NSURL *imageURL = contentEditingInput.fullSizeImageURL;
}];


来源:https://stackoverflow.com/questions/39370406/how-to-extract-image-from-a-live-photo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!