步骤:
1. pod 'GPUImage', '~> 0.1.5'
2. #import "GPUImage.h" 加入.pch文件
3. 加代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIImage *inputImage = [UIImage imageNamed:@"1.jpg"];
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:inputImage];
GPUImageSepiaFilter *stillImageFilter = [[GPUImageSepiaFilter alloc] init];
[stillImageSource addTarget:stillImageFilter];
[stillImageFilter useNextFrameForImageCapture];
[stillImageSource processImage];
UIImage *currentFilteredVideoFrame = [stillImageFilter imageFromCurrentFramebuffer];
UIImageView *imagev=[[UIImageView alloc]initWithImage:currentFilteredVideoFrame];
imagev.frame=CGRectMake(0, 0, inputImage.size.width/2.0f,inputImage.size.height/2.0f);
[self.view addSubview:imagev];
}