GetSystemMetrics module returns wrong screen resolution after running sct.grab(monitor)
See original GitHub issueGeneral information:
-
OS name: Windows 10
-
OS version: 20H2
-
OS architecture: 64 bits
-
Resolutions:
- Monitor 1: 2560x1600(Scale is 175% and the resolution after it is 1463x914)
-
Python version: 3.8.5
-
MSS version: 6.1.0
Description of the warning/error
Neither
Full message
Nope
Other details
First python code is below:
from win32.win32api import GetSystemMetrics
w = GetSystemMetrics (0)
h = GetSystemMetrics (1)
It can return the right resolution: 1463x914
Second python code is below:
from win32.win32api import GetSystemMetrics
import mss
left, top, right, bottom = (100,100,900,700)
with mss.mss() as sct:
# Part of the screen to capture
monitor = {'top': top, 'left': left, 'width': right-left, 'height': bottom-top}
world_sct = np.array(sct.grab(monitor))
w = GetSystemMetrics (0)
h = GetSystemMetrics (1)
It returns: 2560x1600
GetSystemMetrics gives the wrong resolution after taking a screen shot by mss
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How do I prevent GetSystemMetrics() in Python using a ...
I'm using this bit of code to get a print out of the monitor resolution from a Surface Pro 1st Gen Win 8.1...
Read more >GetSystemMetrics() returns incorrect screen size in ... - MSDN
GetSystemMetrics will return correct screen size only for apps that are HiRes aware (High Resolution aware). For apps that are not HiRes aware, ......
Read more >How can we take screenshots using Python in Windows?
A screenshot grabber will use the Windows Graphics Device Interface (GDI) to determine necessary properties such as the total screen size, and to...
Read more >[Source] Python Color Triggerbot - UnKnoWnCheaTs
After adding the module "MSS", I optimized my code, aaaaand. ... sct_img = sct.grab(bbox); # Convert to PIL/Pillow Image; return PIL.
Read more >CAPE Sandbox Book
This concept applies to malware analysis' sandboxing too: our goal is to run an unknown and untrusted application or file inside an isolated ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
mss
instance will set High DPI awareness = PROCESS_PER_MONITOR_DPI_AWARE. So before using mss, the PROCESS is NOT DPI aware, you got 1463x914. Once mss instance created, the PROCESS is DPI aware, then you got the actual resolution 2560x1600.What’s more, during the full lifecycle of PROCESS, DPI awareness can be only set once programmatically or in manifest. Although Windows10 introduces Mixed-Mode DP-aware and support THREAD DPI awareness?
For more details: https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process
Also, the latest release is 6.1.0. 3.2.0 is quite old.