GPU|多重滤镜

UIImage *faceImage = [UIImage imageNamed:@"469453586_640.jpg"];
UIImageView *face = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, faceImage.size.width/2.0, faceImage.size.height/2.0)];
[face setImage:faceImage];
[self.view addSubview:face];

GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:faceImage];
GPUImageBrightnessFilter *brightnessFilter = [[GPUImageBrightnessFilter alloc] init];
[brightnessFilter setBrightness:.15];
GPUImageGrayscaleFilter *grayscaleFilter = [[GPUImageGrayscaleFilter alloc] init];
GPUImagePosterizeFilter *posterizeFilter = [[GPUImagePosterizeFilter alloc] init];
[posterizeFilter setColorLevels:1];
[stillImageSource addTarget:brightnessFilter];
[brightnessFilter addTarget:grayscaleFilter];
[grayscaleFilter addTarget:posterizeFilter];
// these need to be changed if you change the order of your filters
// [brightnessFilter useNextFrameForImageCapture];
// [grayscaleFilter useNextFrameForImageCapture];
[posterizeFilter useNextFrameForImageCapture];
[stillImageSource processImage];
【GPU|多重滤镜】 [face setImage: [posterizeFilter imageFromCurrentFramebuffer]];

    推荐阅读