Change a color in a UIImage

旧城冷巷雨未停 提交于 2019-12-05 07:05:52

问题


I will like to know how I can change just one color in a image. Like saying: if the color in this pixel is "red" change it to "blue".


回答1:


The technical approach is straightforward:

  1. get all pixel values (explained here)
  2. Look for the pixel values you don't like and change them
  3. Draw the image using the changed pixel values (explained here)

Keep in mind, if you mix the three steps into one method, without creating UIColor objects but changing them and immediately afterwards drawing the changed image, you'll get much better performance.



来源:https://stackoverflow.com/questions/9977905/change-a-color-in-a-uiimage

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