'Screenshotting RDP in python not working but normal screenshotting works fine
I've tried using both mss and pyautogui to take a screenshot of a region in Python 3.7. On my machine the screenshots work great, but when trying to use the same code to screenshot the same region on a remote machine I connect to over RDP or Teamviewer, I get the same error message with both screenshot methods: ValueErrpr: tile cannot extend outside image
I've seen solutions fixing this error when cropping, but not when screenshotting. The screenshot code is as follows, to screenshot a region and convert to PIL image:
if settings["ALTERNATIVE SCREENSHOT"]:
with mss.mss() as sct:
# The screen part to capture
region = {'top': top, 'left': left, 'width': width, 'height': height}
# Grab the data
sctimg = sct.grab(region)
img = Image.frombytes("RGB", sctimg.size, sctimg.bgra, "raw", "BGRX")
else:
img = pyautogui.screenshot(region=(left, top, width, height))
This error code appears when using MSS:

and this error code appears when using Pyautogui:
I imagine the fact that this is over RDP is causing this issue. How can I properly take a screenshot with python using a remote display adapter? Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

