Is there a way to parse UIImage pixels?

I have an Info button (Dark) that overlays a UIImageView photo (which the user takes with the camera).

The problem is that if the photo is dark, the button is almost invisible (because it is also dark). So, is there a way to get the color of the part of the image under the info button so that I can change the info button to dark or light?

+3
source share
2 answers

Please see:
Sample 1 (What color is my pixel? Choosing a color on the iPhone)

You will have RGB data for each pixel .. and you can analyze whether it is dark or bright.

or sample 2 (Apple)

+2

, , - . .

, CGDataProviderCopyData(CGImageGetDataProvider(inImage)) , .

+2

Source: https://habr.com/ru/post/1710526/


All Articles