We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

6 posts • Page 1 of 1
Schorschi
Posts: 401
Joined: Thu Nov 22, 2012 9:38 pm

Trying to find an example of how to capture screen to file via python?

Fri Oct 24, 2025 12:56 am

Trying to find an example of how to capture screen to file via python? As a way to figure out why openCV and modules pyautoGUI fail on Pi OS. Tried several methods of trying to capture the desktop and then search that capture for a given 'png' file match in said screen capture. Each example fails stated it does not have authority to read display:0. Really suck, any help appreciated.

gordon77
Posts: 9265
Joined: Sun Aug 05, 2012 3:12 pm

scruss
Posts: 6569
Joined: Sat Jun 09, 2012 12:25 pm

Re: Trying to find an example of how to capture screen to file via python?

Fri Oct 24, 2025 9:02 pm

Schorschi wrote:
Fri Oct 24, 2025 12:56 am
... does not have authority to read display:0
Are you trying to do this remotely? That adds at least one layer of complication.

Gordon's method works, at least for local access.
‘Remember the Golden Rule of Selling: "Do not resort to violence."’ — McGlashan.
Pronouns: he/him


ras_oscar
Posts: 218
Joined: Thu Jan 06, 2022 4:31 pm

ghp
Posts: 4448
Joined: Wed Jun 12, 2013 12:41 pm

Re: Trying to find an example of how to capture screen to file via python?

Sun Oct 26, 2025 2:28 pm

'scrot' runs, but does not work with recent OS using 'wayland'. Produces just plain black images. 'grim' works with 'wayland'.

6 posts • Page 1 of 1

Return to "Python"

AltStyle によって変換されたページ (->オリジナル) /