How can I increase/decrease the brightness of UIImage and I need to save the resultant image?

久未见 提交于 2019-12-08 03:34:46

问题


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?


回答1:


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



回答2:


Here's the sample code and explanation about implementing simple image processing filters (Brightness, Contrast, Saturation, Hue rotation, Sharpness) using OpenGL ES1.1. I recommend you this apple's official link here



来源:https://stackoverflow.com/questions/24080435/how-can-i-increase-decrease-the-brightness-of-uiimage-and-i-need-to-save-the-res

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!