有什么方法可以将 CIImage
转换为 NSData
而无需将 CIImage
转换为 UIImage
或 CGImage
?
我正在尝试制作一个相机应用程序。 抓图时,我用CIImage处理图片,给图片加滤镜效果,编辑一些元数据,用PHAssetCreationRequest保存。
在此过程中,我将 imagedata 更改为 CIImage,将 CIImage 更改为 UIImage,将 UIImage 更改为 NSData。显然这需要时间,我想节省一些时间。
So, Is there any way to convert
CIImage
toNSData
without convertingCIImage
toUIImage
orCGImage
?
最佳答案
CIContext 有一个方法,JPEGRepresentationOfImage:colorSpace:options,可以在不转换为 UIImage 的情况下转换为 NSData。
CIContext *contextToUse = ...;
NSData *imageData = [contextToUse JPEGRepresentationOfImage:image colorSpace:... options:@{}];
关于ios - 有什么方法可以在不将 CIImage 转换为 UIImage 或 CGImage 的情况下将 CIImage 转换为 NSData?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41999892/