1.
UIImage *myImage = [UIImage imageNamed:@"Superman"]; CIContext *context = [CIContext contextWithOptions:nil]; CIImage *superImage = [CIImage imageWithCGImage:myImage.CGImage]; CIFilter *lighten = [CIFilter filterWithName:@"CIColorControls"]; [lighten setValue:superImage forKey:kCIInputImageKey]; // 修改亮度 -1---1 数越大越亮 [lighten setValue:@(0.2) forKey:@"inputBrightness"]; // 修改饱和度 0---2 [lighten setValue:@(0.5) forKey:@"inputSaturation"]; // 修改对比度 0---4 [lighten setValue:@(2.5) forKey:@"inputContrast"]; CIImage *result = [lighten valueForKey:kCIOutputImageKey]; CGImageRef cgImage = [context createCGImage:result fromRect:[superImage extent]]; // 得到修改后的图片 myImage = [UIImage imageWithCGImage:cgImage]; // 释放对象 CGImageRelease(cgImage);
https://blog.csdn.net/u013892686/article/details/49076621
原文地址:https://www.cnblogs.com/javastart/p/11429329.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。