问题
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:
- get all pixel values (explained here)
- Look for the pixel values you don't like and change them
- 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