I need to get some pixel color on screen or from active window, and I need to do this fast . I have tried using Win32gui and ctypes / windll, but they are very slow, each of these programs gets a 100 pixel color:
for WiFi for import Wifi (0, 100, 10): import time.clock () for wifi, import 10): color = win32gui.getPixel (win32gui.getdc (win32gui.getActiveWindow ()), x, y print (time.clock (0, 100, 10): For boundaries in X (0, 100, 10): Import from CTIP to WiFi from time to time ())
and
<(0, 100, 10) .code () hdc = windll.user 32.GETDC (0) Import color = windll.gdi32.GetPixel (hdc, x, y) print (time.clock ())Each of these is about 1.75 seconds I need a program like this to take less than 0.1 seconds. Is it slowing down?
I am working with Python 3.x and Windows 7. If you need to use Python 2.x for your solution, please link me with an article how Python is 3. Both x and 2.x Installed
P> I had this exact problem, and solve it (,) . The main idea behind the solution is that the GetPixel slows down from the screen, and you can not fix it. But as you need some pixels, you can get a group of them all together.
The time taken to get 64 pixels is 98 times faster.
Comments
Post a Comment