可以在iOS中的UIIimagePickerController中拍照之前调整亮度LED

时间:2013-06-19 03:39:50

标签: iphone ios objective-c uiimagepickercontroller uislider

我使用UIImagePickerController构建应用程序打开相机,但我想在拍照之前,我可以调整LED的强度。我想如果可以在UIImagePickerController之前添加UISlider以调整亮度LED,然后拍照就好了,但我不知道如何将UISlider添加到UIImagePickerController

你有想法吗?

1 个答案:

答案 0 :(得分:0)

CGFloat亮度= 0.5;

UIGraphicsBeginImageContext(image.size);

CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height);
CGContextRef context = UIGraphicsGetCurrentContext();

// Original image
[image drawInRect:imageRect]; 

// Brightness overlay
CGContextSetFillColorWithColor(context, [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:brightness].CGColor);
CGContextAddRect(context, imageRect);
CGContextFillPath(context);

UIImage* resultImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
`You can change brightness overlay color to get proper results.`