I am trying to chain two filters (contrast and brightness) and apply it to an image but i only get the contrast filter applied.
Here is the code:
UIImage *inputImage = [UIImage imageNamed:@"2.jpg"];
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:inputImage];
//Set Brightness to 60
GPUImageBrightnessFilter *brightnessFilter = [GPUImageBrightnessFilter new];
[brightnessFilter setBrightness:0.5];
//Set Contrast to 12
GPUImageContrastFilter *contrastFilter = [GPUImageContrastFilter new];
[contrastFilter setContrast:1.0];
[contrastFilter addTarget:brightnessFilter];
[stillImageSource addTarget:contrastFilter];
[contrastFilter useNextFrameForImageCapture];
[stillImageSource processImage];
UIImage *outputImage1 = [contrastFilter imageFromCurrentFramebuffer];
imageView.image = outputImage1;
i hope this solves your problem..
GPUImageView *imageView = [[GPUImageView alloc] initWithFrame:CGRectMake(x, y, width, height)];
[self.view addSubview:imageView];
UIImage *inputImage = [UIImage imageNamed:@"2.jpg"];
GPUImagePicture *stillImageSource = [[GPUImagePicture alloc] initWithImage:inputImage];
//Set Brightness to 60
GPUImageBrightnessFilter *brightnessFilter = [[GPUImageBrightnessFilter alloc]init];
[brightnessFilter setBrightness:0.5];
//Set Contrast to 12
GPUImageContrastFilter *contrastFilter = [[GPUImageContrastFilter alloc]init];
[contrastFilter setContrast:1.0];
[stillImageSource addTarget:brightnessFilter];
[brightnessFilter addTarget:contrastFilter];
[contrastFilter addTarget:imageView];
[stillImageSource processImage];
[contrastFilter useNextFrameForImageCapture];
UIImage *outputImage1 = [contrastFilter imageFromCurrentFramebuffer];
imageView.image = outputImage1;