I have an imageview in my app and I have loaded image from phone photo library. Now I want to apply effect on this image but the code that I have written is giving me error.My code is as follows.Any help will be appreciated.

```
CIImage *beginImage =
[CIImage imageWithContentsOfURL:self.imageView.image];

// 1
CIContext *context = [CIContext contextWithOptions:nil];

CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone"
                              keysAndValues: kCIInputImageKey, beginImage,
                    @"inputIntensity", @0.8, nil];
CIImage *outputImage = [filter outputImage];

// 2
CGImageRef cgimg =
[context createCGImage:outputImage fromRect:[outputImage extent]];

// 3
UIImage *newImage = [UIImage imageWithCGImage:cgimg];
self.imageView.image = newImage;

// 4
CGImageRelease(cgimg);

```