Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaling issue on Windows affecting screenshots #116

Closed
asweigart opened this issue Dec 21, 2016 · 4 comments
Closed

Scaling issue on Windows affecting screenshots #116

asweigart opened this issue Dec 21, 2016 · 4 comments

Comments

@asweigart
Copy link
Owner

Copying this email that was sent to me:

I am trying to take a screenshot using the pyautogui.screenshot() function. It takes the screenshot and saves it properly. But the problem is that the picture is way too small. It does not capture the whole screen. And if I take screenshot with some region like region=(0, 0, 150, 690) it captures only about (0, 0, 120, 547). I am not a great programmer, but I think that the problem is not in pyautogui but in PIL. Because PIL.ImageGrab.grab() gives also too small pictures!

I am using Python 3.5.2 (v3.5.2:4def2a2901a5) and it is 64 bit. My pyautogui version that I am using is '0.9.33' and my PIL version is '3.4.2'.
And windows 10.

I did more research and found this article on stackoverflow which worked for me. I had to change the "Disable display scaling on high DPI settings" to true on every python.exe file.
Link: http://stackoverflow.com/questions/24370228/python-imaging-library-fails-to-grab-whole-screen?answertab=active#tab-top

@glitchassassin
Copy link

Probably related to #110

@glitchassassin
Copy link

Just ran across a workaround proposed by @starbadger in #31:

from ctypes import windll
user32 = windll.user32
user32.SetProcessDPIAware()

@asweigart
Copy link
Owner Author

I've added the DPI scaling fix to 0.9.35, so hopefully this is now fixed.

@nickheyer
Copy link

I've added the DPI scaling fix to 0.9.35, so hopefully this is now fixed.

I do believe you've fixed this, but unfortunately in doing so you've reset the scaling for my monitor. As I am using a very large 4k ultra-widescreen, my app interface is now very tiny. The import mentioned above does the same thing, so I assume you've implemented the same logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants