I need to detect the predominant color or the ligthing of a picture. It is possible? And how?
It is possibile to extract that data from a CGIMAGE? Thanks
I need to detect the predominant color or the ligthing of a picture. It is possible? And how?
It is possibile to extract that data from a CGIMAGE? Thanks
Resize the image to 1x1 pixel. Use the category UIImage+ColorAtPixel.h to extract the value of the pixel. You can transform the CGImage to a UIImage with imageWithCGImage:.
To extract the value of the pixel, the category creates a context (CGBitmapContextCreate) with a RGBA buffer of 4 char and draws the image there. Then it extracts the color from the 4 components (RGBA) of the image.