Questions tagged [python-mss]

An ultra fast cross-platform multiple screenshots module in pure Python using ctypes.

77 questions
2
votes
0 answers

opencv python screen capture in ubuntu

I am trying to capture the screen and show the images continuously using opencv-python. But for some reason the images are not stacking on top of each others like normally. Please look at the source code and the screenshot below. I am on ubuntu…
CoFlo
  • 21
  • 2
2
votes
0 answers

Resize screenshot with mss for better reading with pytesseract

I need to resize an screenshot taken by mss in order to get better reading by pytesseract and i get it done with pil+pyscreenshot but can't get it to with mss. from numpy import array, flip from mss import mss from pytesseract import…
Siewdass Sf
  • 169
  • 1
  • 10
2
votes
1 answer

opencv cap.read has an Attribute error. How to troubleshoot?

We are currently integrating two codes: 1. mss Image grab for screen recording 2. opencv color tracker We encountered this error: File "C:/Users/John Wong/Desktop/Test2.py", line 28, in _, img = cap.read() AttributeError: 'NoneType' object…
Markus
  • 59
  • 6
2
votes
2 answers

Take screenshot without writing to disk

I want to have a python script that can take a screenshot without saving it directly to the disk immediately. Basically is there a module with a function that returns the raw bytes that I can then write into a file by myself manually? import…
eclipse
  • 197
  • 1
  • 5
  • 16
2
votes
3 answers

Screenshot [ctypes.windll CreateDCFromHandle]

I am creating a screenshot module using only pure python (ctypes), no big lib like win32, wx, QT, ... It has to manage multi-screens (what PIL and Pillow cannot). Where I am blocking is when calling CreateDCFromHandle, ctypes.windll.gdi32 does not…
Tiger-222
  • 6,677
  • 3
  • 47
  • 60
1
vote
1 answer

Screenshot error: XDefaultRootWindow() failed after closing a Tkinter Toplevel --> Python MSS Ubuntu Linux

Ubuntu v22.04 MSS v7.0.1 Python 3.10 This issue is practically identical to: Python: Tkinter + MSS = mss.exception.ScreenShotError: XDefaultRootWindow() failed - however, their question is unsolved. For a minimum reproducible example, see…
ktom
  • 125
  • 8
1
vote
1 answer

Python mss only capturing 60 fps, even with multiprocessing?

I've been using mss for screen capturing for a while, and no matter what I can't get it above 60 fps, even with multiprocessing. Here's the code: import multiprocessing as mp import time import mss def task(): start = time.time() for…
BappoHotel
  • 52
  • 10
1
vote
1 answer

OpenCV wont object detect with MSS screen capture

I'm new to Python and want to learn it bit by bit, so I decided to write a simple program that would, in real time, capture my screen and do object detection. Through a lot of googling and reading, I was able to make this script, however, no matter…
Forseen
  • 11
  • 3
1
vote
1 answer

Python-mss error: Impossible to take screenshot on regions with grab()

I am trying to use mss and opencv to find images on the screen. However, whenever I try to use regions with mss I get this error: It seems this issue is related to some ressources not being freed: python mss mss.exception.ScreenShotError: I found…
bobier2
  • 127
  • 10
1
vote
1 answer

How to read text directly from screen using python

I want to build project that reads texts continuously from part of my pc screen and shows them on the console of pycharm I am using python 3, all modules are installed using pip from pycharm console. I used this code: import time import cv2 import…
Alimo
  • 11
  • 1
  • 1
  • 4
1
vote
0 answers

Get capture from fullscreen

I'm trying to make a "video" of my screen, so that the opencv can analyze it, and so far it works well, however when I go into full screen mode, the program stops recording or analyzing, this stops working. Can you help me? from mss import…
1
vote
1 answer

TypeError: Expected Ptr for argument 'mat' using mss library in python

I am trying to screenshot using mss library add display it using below code but getting same error every time. Is there a fix for this error TypeError: Expected Ptr for argument 'mat' ** I am using this in Macos not windows import cv2 as…
Zac
  • 323
  • 7
  • 14
1
vote
1 answer

Python screen share

Hi Im trying to build an application in python 3 for screen sharing and I looked in other codes from the internet (some of them from StackOverFlow) and all of them just rapidly open up screenshots of my screen without capturing them into one screen…
Ilay xD
  • 11
  • 2
1
vote
0 answers

Facing an issue while taking screen shots with python

I am facing an issue while taking screen shots using mss module in python, sometimes it is working fine and some times giving black screen as output. Please provide me solution for this problem. I have tried to take screen shots with mostly all the…
Sankar R
  • 11
  • 1
1
vote
1 answer

MSS repeats frames when recording computer screen

I am trying to record the screen on my MacBook pro and store it in a video file. This isn't the end goal but this is the first step and I am noticing whatever I set my writing framerate to, I only get half of those in my final video. e.g. if I set…
Vipul Rajan
  • 494
  • 1
  • 5
  • 16