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.

Fullscreen doesn't capture as expected with fullscreen game

See original GitHub issue

Hi,

I was under the impression that this package should be able to make game screenshot. I did the following :

import time

#launch script then alt+tab to game
n_seconds = 5
for x in range(n_seconds):
	print "taking screenshot in {}".format(n_seconds-x)
	time.sleep(1)

from mss.windows import MSS as mss
sct = mss()
filename = sct.shot(output='test.png')

However all I’m getting is this :

https://www.dropbox.com/s/yy5qnltobdp02v6/test.png?dl=0

Is this what is expected? Thanks.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
WandersonKnightcommented, Apr 11, 2021

Turns out that it was a problem with Pynput keyboard listener, i used a shortcut to take the screenshot, it needed elevated privileges to work with games (Why?). All good, friend, sorry 😉

1reaction
karanlyonscommented, Nov 22, 2017

I’d guess this is because “Fullscreen” in games (versus “Borderless Window” or the like) uses “Exclusive Mode”/“Active Rendering” wherein the application itself works directly with the GPU to write to the screen, as opposed to to working with the window manager.

It’s not impossible to take screenshots per se, but you won’t be able to do so through the window manager APIs. In the case of video games (or anything using DirectX in exclusive mode) it’s usually done through DLL injection to hook into DirectX drawcalls.

(A cursory examination of windows.py appears to indicate as well that only capturing of the first screen is supported as well, owing to the hardcoded argument to ctypes.windll.user32.GetWindowDC.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't I shoot or make printscreen games in fullscreen?
Hello, I wanted to make a printscreen game. So I simply turned it on and pressed the print screen on the keyboard.
Read more >
Game Capture with "Capture any fullscreen application" does ...
If steam.exe could be blacklisted or de-prioritized, it would be possible to use the generic "Capture any fullscreen application" to capture any ...
Read more >
OBS STUDIO NOT RECORDING FULL SCREEN HOW TO FIX!
This video shows how to fix if you cannot record fullscreen on OBS Studio really easy!What i use:Blue Snowball USB ...
Read more >
Best Ways to Fix OBS Not Recording Full Screen
The justification behind the OBS dark screen under the present circumstance is in all probability because of OBS and the game you need...
Read more >
can't capture mouse in Windowed, stuttery in Fullscreen ...
Yes, you're still running the game in forced windowed mode, so attribute Fake has no effect at all, it's a fullscreen attribute. Run...
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