I have created an NSImage object, and ideally would like to determine how many of each pixels colour it contains. Is this possible?
Using colorAtX
with NSBitmapImageRep
does not always lead to the exact correct color.
I managed to get the correct color with this simple code:
[yourImage lockFocus]; // yourImage is just your NSImage variable
NSColor *pixelColor = NSReadPixel(NSMakePoint(1, 1)); // Or another point
[yourImage unlockFocus];