A simple and powerful Python library for taking screenshots
Project description
qshoot22
A simple and powerful Python library for taking screenshots.
Features
- 📸 Easy-to-use screenshot capture
- 🎯 Capture full screen or specific regions
- 💾 Save screenshots to custom directories
- 🔧 Return PIL Image objects for further processing
- 🐍 Python 3.8+ support
- 📦 Cross-platform (Windows, macOS, Linux)
Installation
pip install qshoot22
For development:
pip install qshoot22[dev]
Quick Start
Basic Usage
from qshoot2 import Screenshot
# Create a screenshot instance
shooter = Screenshot()
# Capture full screen and save
filepath = shooter.capture_full_screen()
print(f"Screenshot saved to: {filepath}")
# Capture full screen and get PIL Image object
image = shooter.capture_full_screen(return_image=True)
image.show()
Capture Region
# Capture a specific region (x, y, width, height)
shooter = Screenshot()
image = shooter.capture_region(100, 100, 500, 300, return_image=True)
image.show()
Custom Output Directory
from pathlib import Path
# Set custom output directory
shooter = Screenshot(output_dir=Path("./screenshots"))
filepath = shooter.capture_full_screen(filename="my_screenshot")
Utility Functions
from qshoot2 import capture, capture_region
# Quick capture
image = capture(return_image=True)
# Quick region capture
image = capture_region(0, 0, 200, 200, return_image=True)
Get Screen Size
from qshoot2 import Screenshot
width, height = Screenshot.get_screen_size()
print(f"Screen resolution: {width}x{height}")
Advanced Usage
With Custom Filename
shooter = Screenshot()
filepath = shooter.capture_full_screen(filename="desktop_2025")
Processing Screenshots
from qshoot2 import Screenshot
from PIL import Image, ImageFilter
shooter = Screenshot()
image = shooter.capture_full_screen(return_image=True)
# Apply filters
blurred = image.filter(ImageFilter.BLUR)
grayscale = image.convert('L')
# Save processed images
blurred.save("blurred.png")
grayscale.save("grayscale.png")
API Reference
Screenshot Class
__init__(output_dir=None)
Initialize Screenshot instance.
output_dir: Directory to save screenshots (default: current directory)
capture(region=None, filename=None, return_image=False)
Take a screenshot.
region: Tuple of (x, y, width, height) for partial screenshotfilename: Custom filename (without extension)return_image: If True, returns PIL Image object- Returns: PIL Image object or Path to saved file
capture_full_screen(filename=None, return_image=False)
Capture full screen.
filename: Custom filenamereturn_image: If True, returns PIL Image object- Returns: PIL Image object or Path to saved file
capture_region(x, y, width, height, filename=None, return_image=False)
Capture a specific region.
x, y: Top-left coordinateswidth, height: Dimensions of regionfilename: Custom filenamereturn_image: If True, returns PIL Image object- Returns: PIL Image object or Path to saved file
get_screen_size()
Get the screen resolution.
- Returns: Tuple of (width, height)
Requirements
- Python 3.8+
- pyautogui >= 0.9.54
- Pillow >= 10.0.0
Development
Running Tests
pytest
Code Formatting
black qshoot2 tests
isort qshoot2 tests
Type Checking
mypy qshoot2
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues, please report them on the GitHub Issues page.
Changelog
0.1.0 (2025-01-19)
- Initial release
- Basic screenshot capture functionality
- Full screen and region capture
- Custom output directory support
- PIL Image object return option
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qshoot2-0.1.0.tar.gz.
File metadata
- Download URL: qshoot2-0.1.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b721fd9815b08fa3a4991c7c02d2823f08a33a97a49d291990341e57652d87d6
|
|
| MD5 |
15a63b62170d8bfa142d01d9e04fd076
|
|
| BLAKE2b-256 |
34f13651fb0c70aba54eeb9901cf7684ce75e00331eb19428a3c9acc181bef78
|
File details
Details for the file qshoot2-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qshoot2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
813659bc481d8854460d92bbd474f320e2bc709ac14f68a7fa4bf6c0863a41ec
|
|
| MD5 |
5b632b769f8ea843b74904b70393fef3
|
|
| BLAKE2b-256 |
ab77c5509c4dd9ff33fa61118cd2858e335fc2b5068714d207dd062a1c26c749
|