码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 图像处理-调整图像亮度

时间:2017-06-04 18:25:54      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:nal   www   tput   text   key   options   blank   icon   tail   

- (UIImage*) getBrighterImage:(UIImage *)originalImage
{
    UIImage *brighterImage;
    CIContext *context = [CIContext contextWithOptions:nil];
    CIImage *inputImage = [CIImage imageWithCGImage:originalImage.CGImage];

    CIFilter *lighten = [CIFilter filterWithName:@"CIColorControls"];
    [lighten setValue:inputImage forKey:kCIInputImageKey];
    [lighten setValue:@(0.3) forKey:@"inputBrightness"];
    
    CIImage *result = [lighten valueForKey:kCIOutputImageKey];
    CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]];
    brighterImage = [UIImage imageWithCGImage:cgImage];
    CGImageRelease(cgImage);
    
    return brighterImage;
}


參考链接:

http://www.raywenderlich.com/22167/beginning-core-image-in-ios-6

http://blog.csdn.net/willyang519/article/details/38716019

iOS 图像处理-调整图像亮度

标签:nal   www   tput   text   key   options   blank   icon   tail   

原文地址:http://www.cnblogs.com/clnchanpin/p/6941142.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!