如何增加/减少 UIImage 的亮度,我需要保存结果图像? [英] How can I increase/decrease the brightness of UIImage and I need to save the resultant image?

查看:80
本文介绍了如何增加/减少 UIImage 的亮度,我需要保存结果图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图像,我想改变它的亮度,我需要保存从实际图像中获得的结果图像,我该怎么做.我想使用 UIslider 增加亮度?

I've an image , I want to change its brightness and I need to save the resultant image obtained from the actual image, how can I do it. I want to increase the brightness using a UIslider?

推荐答案

从 Github 获取 UIImage 类别的代码 这里.

Get the code from the Github for UIImage category here.

要使图像变亮,请编写如下代码:

To brighten the image, write the code as below:

//brighten value can be obtained from slider change event from -255 to 255.
UIImage* brightImage = [originalImage brightenWithValue:sliderValue];

//Convert image into data
NSData *brightImageData = UIImagePNGRepresentation(brightImage);

//Get the path of Documents directory and store the data object to proper file

这篇关于如何增加/减少 UIImage 的亮度,我需要保存结果图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆