question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi-DPI not correctly detected in Windows 10

See original GitHub issue

General informations:

  • OS name: Windows
  • OS version: 10, version 1709
  • OS architecture: 64 bits
  • Resolutions:
    • Monitor 1: 3840x2160
    • Monitor 2: 3840x2160
  • Python version: 3.6.1
  • MSS version: 3.2.0

Description of the warning/error

I have two monitors, both 3840x2160. My scaling is 200%. Screenshotting either one individually, or both together crops the right and bottom sides. I get two 2880x1620 images, or one 5760x1620.

monitors returns these values:

>>> for m in sct.monitors:
    print(m)

{'left': 0, 'top': 0, 'width': 5760, 'height': 1620, 'scale': 1.5}
{'left': 0, 'top': 0, 'width': 2880, 'height': 1620, 'scale': 1.5}
{'left': 2880, 'top': 0, 'width': 2880, 'height': 1620, 'scale': 1.5}

Other details

Dividing the resolution by 1.5 and multiplying by 2 gives the correct resolution - it seems to just be detecting the scaling incorrectly. I think this is related to #20.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
ryanfoxcommented, Apr 26, 2018

I found a workaround - you need to make Python DPI-aware:

import ctypes
ctypes.windll.user32.SetProcessDPIAware(1)

Executing that before creating the sct object gives me full-resolution screenshots of both monitors.

1reaction
ryanfoxcommented, Apr 26, 2018

If I manually specify the resolution, it captures the full desktop across both monitors:

sct.grab({'left': 0, 'top': 0, 'width': 7680, 'height': 2160, 'scale': 2})

lets me save the full image.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows scaling issues for high-DPI devices - Microsoft Support
To work around scaling issues, try the following methods: ... Change application properties In Explorer or on the Start menu, right-click the application...
Read more >
How to Adjust High-DPI Scaling in Windows 10 | Digital Trends
1. Click the Notification icon on the Taskbar and select the All Settings tile in the Action Center. Alternatively, click the Start button...
Read more >
Microsoft May Never Fix the High DPI Issues in Windows 10
It appears that Windows polls an app before it runs asking if it is HiDpi compliant or not. Depending on the response Windows...
Read more >
Application not rendering correctly in Windows on a high ...
The first option is to change the display scaling in Windows to 100%. Search for "scaling" or "display" in the search field to...
Read more >
Troubleshooting IDE scaling (DPI) issues on Windows
The issue with the IntelliJ IDEA UI mis-scaling was caused by incorrectly switching the DPI-awareness mode in runtime. Unfortunately, we were unable to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found