📸 mistercar-screenshooter 💥
🚀 A versatile, high-performance Python package for cross-platform screen capturing and recording. It offers functionality for full screen, region, window, and monitor capture, as well as video recording capabilities. 🎞️
🛠️ Installation
pip install mistercar-screenshooter
📚 Usage
Here's a comprehensive example demonstrating all the main features of screenshooter:
from mistercar_screenshooter import ScreenCapture
import cv2
import time
# Create a ScreenCapture instance
sc = ScreenCapture()
# 1. Capture the entire screen
screen = sc.capture_screen()
cv2.imwrite("full_screen.png", cv2.cvtColor(screen, cv2.COLOR_RGB2BGR))
# 2. Capture a specific region
region = sc.capture_region((100, 100, 500, 500))
cv2.imwrite("region.png", cv2.cvtColor(region, cv2.COLOR_RGB2BGR))
# 3. Capture a specific window (Windows only)
try:
window = sc.capture_window("*Untitled - Notepad")
cv2.imwrite("window.png", cv2.cvtColor(window, cv2.COLOR_RGB2BGR))
except NotImplementedError:
print("Window capture is not supported on this platform.")
# 4. List and capture from multiple monitors
monitors = sc.list_monitors()
for i, monitor in enumerate(monitors):
img = sc.capture_monitor(i)
cv2.imwrite(f"monitor_{i}.png", cv2.cvtColor(img, cv2.COLOR_RGB2BGR))
# 5. Record a video
sc.record_video("output.mp4", duration=5, fps=60, capture_type="screen")
# 6. Use the recorder for continuous capture
recorder = sc.create_recorder("screen")
recorder.start()
start_time = time.time()
frame_count = 0
while time.time() - start_time < 5: # Record for 5 seconds
frame = recorder.get_latest_frame()
# In a real application, you might process or save the frame here
frame_count += 1
recorder.stop()
print(f"Captured {frame_count} frames in 5 seconds (approx. {frame_count / 5:.2f} FPS)")
This example covers all main functionalities:
- 📷 Full screen capture
- 🔍 Region capture
- 🪟 Window capture (Windows only)
- 🖥️🖥️ Multiple monitor support
- 🎥 Video recording
- 🔄 Continuous capture with the recorder
You can find this example as a runnable script in the examples/demo.py file in the repository.
Platform-specific notes
🪟 Windows
On Windows, screenshooter uses the BetterCam library for high-performance screen capture. This provides several benefits:
- ⚡ High-speed capture (240Hz+ capable)
- 🎮 Ability to capture from Direct3D exclusive full-screen applications
- 🖼️ Automatic adjustment for scaled/stretched resolutions
🐧 Linux and 🍎 macOS
On Linux and macOS, screenshooter uses the MSS (Multiple Screen Shot) library for screen capture. While it doesn't offer the same level of performance as BetterCam on Windows, it provides a consistent cross-platform experience.
🙏 Acknowledgements
ScreenShooter is built upon these fantastic projects:
- 🖼️ BetterCam: The world's fastest Python screenshot library for Windows.
- 🖥️ MSS (Multiple Screen Shot): An ultra fast cross-platform multiple screenshots module in pure Python using ctypes.
We're grateful to the maintainers and contributors of these projects for their excellent work!
🧪 Testing
To run the tests, install pytest and run:
pytest tests/
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for mistercar-screenshooter 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mistercar_screenshooter-1.1.0.tar.gz | 9.0 kB | Without provenance | Details for mistercar_screenshooter-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mistercar_screenshooter-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for mistercar_screenshooter-1.1.0-py3-none-any.whl |
Total release size: 24.1 kB
Release files / mistercar_screenshooter-1.1.0.tar.gz
| Download URL | mistercar_screenshooter-1.1.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c793b0e7a72f6cb819cd53e2be115121671d4e4d1c6305bd70cc0ed035f3b02
|
|
BLAKE2b-256 checksum How to use checksums |
2347ff9fdcfe251b132bf762ed0d79e56ce5a31b795e16e6b294ee76ae8848f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / mistercar_screenshooter-1.1.0-py3-none-any.whl
| Download URL | mistercar_screenshooter-1.1.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d4821ae9f8c47603fc42ff8f0c4a6df0bd1e2e5ec6cdace48a1726a78dbbbe0
|
|
BLAKE2b-256 checksum How to use checksums |
457884ed553be0162d43a411ebcdd85050d3ef2c894219a037d32136e632de0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Security for mistercar-screenshooter 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.