Brightness control slider is very slow in responding in iOS

536 views Asked by At

I really need help.

I am creating simple image processing app, where I load an UIImage from the camera roll or I take a picture. I have a brightness control (slider) that will adjust the brightness of the image. The problem is slider works in real time on the simulator, but on the iphone there is small delay in response. I have tried everything, but don't seem to have any luck.

Please help. I have seen other apps where slider works smoothly without any delay. What am I doing wrong?

Thanks

- (IBAction)brightnessValueChanged:(id)sender {
      float b;
      b = self.brightnessSlider.value;
      self.image = _sourceImage;
      self.finalImageView.image = [self.image imageWithContrast:b brightness:b-1.5];
}
1

There are 1 answers

0
Milan patel On BEST ANSWER

You try this..?

viewDidLoad{



  UIImage *aUIImage = showPickedImageView.image;
    CGImageRef aCGImage = aUIImage.CGImage;
    aCIImage = [CIImage imageWithCGImage:aCGImage];


    context = [[CIContext contextWithOptions:nil] retain];
    brightnessFilter = [[CIFilter filterWithName:@"CIColorControls" keysAndValues: @"inputImage", aCIImage, nil] retain];

}

-(IBAction)brightnessSliderValueChanged:(UISlider *)sender {

[brightnessFilter setValue:[NSNumber numberWithFloat:brightnessSlider.value ] forKey: @"inputBrightness"];
outputImage = [brightnessFilter outputImage];
CGImageRef cgiig = [context createCGImage:outputImage fromRect:[outputImage extent]];
newUIImage = [UIImage imageWithCGImage:cgiig];
CGImageRelease(cgiig);
[showPickedImageView setImage:newUIImage];

}

This works smooth in iPhone (Device).