【发布时间】:2010-09-05 00:08:09
【问题描述】:
我正在编写一个将 AVFoundation 用于相机内容的 iPhone 应用程序,我正在尝试将 UIImage 从相机保存到相机胶卷中。
目前是这样做的……
[imageCaptureOutput captureStillImageAsynchronouslyFromConnection:[imageCaptureOutput.connections objectAtIndex:0]
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
{
if (imageDataSampleBuffer != NULL)
{
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
MyCameraAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate processImage:image];
}
}];
我一直在观看 WWDC 教程视频,我认为 2 行(NSData...和 UIImage...)是从 imageDataSampleBuffer 到 UIImage 的漫长过程。
将图像保存到库似乎需要很长时间。
有谁知道是否有单行转换可以让 UIImage 脱离这个?
感谢您的帮助!
奥利弗
【问题讨论】:
-
啊,我仔细看看发生了什么,不是转换需要很长时间,而是将其保存到照片库。