I want to add different effects to an UIImage. Currently I am trying with using GUIImage library. https://github.com/BradLarson/GPUImage But, I am unable to run most of the examples provided. Only working example for me is FilterShowcase It works great.
But the problem is, its work only with camera. What i want is Load an static image on to a UIImageView and apply those filters.
I tried, but unable to do it.
This is how I tried it
- (void)setupFilter;
{
// videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
//// videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionFront];
// videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 350)];
imgView.Image=[UIImage imageNamed:@"WID-small.jpg"];
[self.view addSubview:imgView];
BOOL needsSecondImage = NO;
switch (filterType)
{
case GPUIMAGE_SEPIA:
{
self.title = @"Sepia Tone";
self.filterSettingsSlider.hidden = NO;
[self.filterSettingsSlider setValue:1.0];
[self.filterSettingsSlider setMinimumValue:0.0];
[self.filterSettingsSlider setMaximumValue:1.0];
filter = [[GPUImageSepiaFilter alloc] init];
sourcePicture = [[GPUImagePicture alloc] initWithImage:imgView.image smoothlyScaleOutput:YES];
[sourcePicture processImage];
[sourcePicture addTarget:filter];
}; break;
Actually what I tried to do is, Load a still image instead of videoCamera. But it doesn't work. If anyone can help me, its highly appreciated.