I am using pywinauto to take a screenshot of a specific window.
Here is the code I use to take a capture of notepad ("Bloc-notes" in french) :
from pywinauto import Application
app = Application().connect(title_re=".*Bloc-notes")
hwin = app.top_window()
hwin.set_focus()
img = hwin.capture_as_image()
img.save('notepad_screenshot.png')
And here is the result:
The red "border" is the background of the window. How can I safely eliminate this red border?
I tried to configure Windows 10 in order not to show windows shadows (in the "visual effects settings") but it has no effect on the size of the capture.
When I look precisely on the capture, I can see that the left, bottom and right borders are 7 pixels thick. Can I reliably remove these pixels? What I mean by "reliably" is: will it always work, and work on other computers?
Any help appreciated.