Get RGB value from screen pixels with python

前端 未结 1 1169
说谎
说谎 2021-01-03 05:58

To get the RGB values from a pixel of the screen with coordinates (x,y) in Python, I do:

import PIL.ImageGrab
rgb = PIL.ImageGrab.grab().loa         


        
相关标签:
1条回答
  • 2021-01-03 06:21

    If you do:

    import PIL.ImageGrab
    PIL.ImageGrab.grab().size
    

    You will see the resolution that python is detecting in your system. If you are using Windows, you have to go to Screen Configuration and then change: text, aplications and another elements size to 100%.

    If your resolution is 1920x1080 ,as you said, this should fix the problem.

    0 讨论(0)
提交回复
热议问题