![](/img/trans.png)
[英]UIImage looses its orientation while converting it into CIImage, then into CGImage and back to UIImage
[英]Is there any way to convert CIImage to NSData without converting CIImage to UIImage or CGImage?
有什么方法可以将CIImage
转换为NSData
而不将CIImage
转换为UIImage
或CGImage
?
我正在尝试制作相机应用。 捕获图像时,我使用CIImage处理图像以使图像具有滤镜效果,编辑一些元数据并通过PHAssetCreationRequest保存。
在此过程中,我将图像数据更改为CIImage,将CIImage更改为UIImage,将UIImage更改为NSData。 显然,这需要时间,我想节省一些时间。
因此,有没有办法将
CIImage
转换为NSData
而无需将CIImage
转换为UIImage
或CGImage
?
CIContext有一个JPEGRepresentationOfImage:colorSpace:options方法,可以转换为NSData而无需转换为UIImage。
CIContext *contextToUse = ...;
NSData *imageData = [contextToUse JPEGRepresentationOfImage:image colorSpace:... options:@{}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.