Quickly getting the color of some pixels on the screen in Python on Windows 7

前端 未结 4 933
说谎
说谎 2020-12-04 22:44

I need to get the color of some pixels on the screen or from the active window, and I need to do so quickly. I\'ve tried using win32gui and ctypes/

4条回答
  •  情书的邮戳
    2020-12-04 23:23

    I had this same exact problem, and solved it (in Java, in C#). The main idea behind the solution is GetPixel from screen is slow, and you can't fix that. But as you need some pixels, you can get a bunch of them all at once.

    The time that it took to get 64 pixels was 98 times faster.

提交回复
热议问题