0

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];
}
Rajesh Loganathan
  • 11,129
  • 4
  • 78
  • 90
  • Sounds like your device is not responding as quickly, if the device is older this happens a lot. This happens in many apps and from experience there isn't a huge amount your can do about it. How large are your images/the image view that you are trying to adjust? This may have a part to play in the delay. – App Dev Guy Dec 11 '14 at 06:23
  • there is only one image – Wahab Ahmad Niazi Dec 11 '14 at 06:43
  • What size is the image? What device are you testing on and what version of iOS are you using? – App Dev Guy Dec 11 '14 at 06:44
  • I take picture from camera in iphone ios 8 and then adjust brightness to this image using uislider – Wahab Ahmad Niazi Dec 11 '14 at 07:07
  • The only other thing I can think of is the size of the image is so big in size that it takes a moment for the slider to respond. You can resize the image and there are several methods on Stack to help with that. So when you select the image, it will resize and then when you edit it it should reduce any lag. Hopefully this helps. – App Dev Guy Dec 11 '14 at 07:11

1 Answers1

0

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).

Milan patel
  • 223
  • 2
  • 15