7

我想在 Java 中扫描屏幕以查找特定颜色。

知道怎么做吗?

4

2 回答 2

14
    Robot robot = new Robot();
    Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
    BufferedImage bufferedImage = robot.createScreenCapture(captureSize);
    // ...

    int color = image.getRGB(x, y);

    int  red = (color & 0x00ff0000) >> 16;
    int  green = (color & 0x0000ff00) >> 8;
    int  blue = color & 0x000000ff;
    // ...
于 2010-06-13T19:15:32.153 回答
2

使用 Java.awt.Robot 将屏幕截图作为图像并进行处理。

于 2010-06-13T19:10:49.090 回答