How to use the ImageGrab.grab().load() function or any other function to get pixel updates?

那年仲夏 提交于 2019-12-02 05:33:27

This works for me:

#!/usr/bin/env python3

from PIL import ImageGrab

while True:
   px=ImageGrab.grab().load()
   m=px[613,296]
   print(m)

I think it will be faster if you just grab one pixel though by specifying a bounding box like this so you only grab one pixel:

#!/usr/bin/env python3

from PIL import ImageGrab

while True:
   screen=ImageGrab.grab(bbox=(613,296,614,297))
   px = screen.load()
   m=px[0,0]
   print(m,screen.size)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!