iOS,如何保存Photo Sphere XMP元数据,同时将其保存到相机胶卷?

iOS,如何保存Photo Sphere XMP元数据,同时将其保存到相机胶卷?,第1张

概述我可以将 Photo Sphere XMP Metadata添加到equirectangular照片. 我将带有XMP元数据的照片上传到Google相册,Google照片可以被识别为球形照片. 然后,我尝试将带有XMP元数据的照片保存到相机胶卷. 我通过相机胶卷将照片分享给Google相册,但Google相册并不知道这是一张球形照片. 我试图下载照片并对其进行分析,发现XMP元数据全部消失了. 当 我可以将 Photo Sphere XMP Metadata添加到equirectangular照片.
我将带有XMP元数据的照片上传到Google相册,Google照片可以被识别为球形照片.
然后,我尝试将带有XMP元数据的照片保存到相机胶卷.
我通过相机胶卷将照片分享给Google相册,但Google相册并不知道这是一张球形照片.
我试图下载照片并对其进行分析,发现XMP元数据全部消失了.
当照片保存到相机胶卷时,iOS似乎会编辑元数据.
有没有办法保存照片的XMP元数据,同时将其保存到相机胶卷?

// raw jpg data to NSDataNsstring *img = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"equirectangular_orig.jpg"];NSData* imgData = [[NSfileManager defaultManager] contentsAtPath:img];NSMutableData *newimgData = [NSMutableData dataWithData:imgData];// writing XMP Metadata to newimgData// ...// ...// saving the newimgData to new jpg fileNsstring *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"documents"] stringByAppendingPathComponent:@"equirectangular_xmp.jpg"];NSURL *url = [NSURL fileURLWithPath:path];[[NSfileManager defaultManager] removeItemAtPath:[url absoluteString] error:nil];[newimgData writetoURL:url atomically:YES];// saving the new jpg file to camera rollUIImage *newimg = [UIImage imageWithData:newimgData];UIImageWritetoSavedPhotosAlbum(newimg,self,nil,nil);
解决方法 关键点:使用

[PHAssetChangeRequest creationRequestForAssetFromImageAtfileURL: url]

代替

[PHAssetChangeRequest creationRequestForAssetFromImage:image]

因为UIImage会破坏原始文件,只需使用临时URL保存原始图像原始数据,并使用creationRequestForAssetFromImageAtfileURL API.

总结

以上是内存溢出为你收集整理的iOS,如何保存Photo Sphere XMP元数据,同时将其保存到相机胶卷?全部内容,希望文章能够帮你解决iOS,如何保存Photo Sphere XMP元数据,同时将其保存到相机胶卷?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1003096.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存