I'm working on a Java project that involves grabbing the colors of individual pixels on the screen at a fast rate. I initially used an AWT Robot for this task in the following code:
Robot robot = new Robot();
int redVal = 0;
for (int i = 0; i < 255; i++)
redVal += robot.getPixelColor(x[i], y[i]).getRed();
where x[],y[]
, represent the individual locations where I want to get the color value. On a relatively fast CPU, polling the 255 locations takes over 1.5 seconds, too slow for my application. Is there a faster way to get the color of specific pixels on the screen in Java, possibly through a screen capture then post-processing?