如何从实时照片中提取图像? [英] How to extract image from a live photo?
本文介绍了如何从实时照片中提取图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何从实时照片中提取视频.在此处解释.
I know how to extract video from a live photo. Explained here.
使用PHAssetResourceManager
从PHAssetResource
获取视频文件.
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
}
但是如何从PHLivePhoto中提取图像URL.其背后的动机是获取视频和图像URL,以便将其上传到服务器.
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.
推荐答案
假设您可以访问PHAsset,则可以执行以下操作:
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;
}];
这篇关于如何从实时照片中提取图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文