Search code examples
pythonscreenshot

How to take screenshots in Python with certain pixel range?


Does anyone know of any modules or any way in Python to take a screenshot of a certain pixel range on the screen? I have been looking but couldn’t find anything online.


Solution

  • try This one

    import pyscreenshot as ImageGrab
    
    img=ImageGrab.grab()
    img=ImageGrab.grab(bbox=(10,10,500,500))
    
    ImageGrab.grab_to_file('img.jpg')