Skip to main content

ScreenshotScanner Logo

ScreenshotScanner

License: MIT Python 3.8+ PyPI version Downloads CodeQL Status

A heuristic-based tool to detect whether an image is a screenshot or a photo of a physical document.
Star this repo if it helped you!

Features

  • 13 Heuristic Checks - Multiple detection methods for high accuracy
  • Simple API - Easy to integrate into existing workflows
  • Detailed Metrics - Optional verbose mode for debugging
  • No Training Required - Rule-based system, no ML models needed
  • Fast Processing - Analyze images in milliseconds

Installation

Basic Installation

pip install ScreenshotScanner

Quick Start

from screenshot_scanner import ScreenshotScanner

# Initialize scanner
scanner = ScreenshotScanner()

# Process an image (simple one-liner)
result = scanner.process("path/to/image.jpg")

print(result)

Example Output

{
    'is_screenshot': True,
    'score': 8,
    'confidence': 80.0,
    'reasons': ['Has alpha channel', 'Common aspect ratio: 1.78', 'Low ELA: 45.32', 'No EXIF data', 'High sharpness: 156.23']
}

That's it! Just 3 lines of code to detect screenshots.

How It Works

ScreenshotScanner uses 13 different heuristic checks to determine if an image is a screenshot:

  1. Alpha Channel - Screenshots often have transparency
  2. Aspect Ratio - Common screen ratios (16:9, 4:3, etc.)
  3. Border Variance - Uniform borders indicate screenshots
  4. ELA (Error Level Analysis) - Lower compression artifacts in screenshots
  5. EXIF Data - Screenshots typically lack camera metadata
  6. Horizontal Edges - UI elements create horizontal patterns
  7. Moiré Patterns - Photos of screens show moiré, screenshots don't
  8. Noise Analysis - Screenshots have less sensor noise
  9. Sharpness - Screenshots are typically sharper
  10. Solid Color Ratio - UI elements have more solid colors
  11. Status Bar Detection - Mobile screenshots often have status bars
  12. Text Confidence - OCR works better on screenshot text
  13. Vertical Symmetry - UI layouts are often symmetric

Each check contributes to a final score. A score ≥ 5 (default threshold) indicates a screenshot.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Motivation

  • There is no good tool without ML to detect screenshots. So i decided to come up with this.

Contact

Star

If you find this project useful, please consider giving it a star on GitHub!


Made with ❤️ for better document verification by AzwadFawadHasan

Visitor Count

Release files for ScreenshotScanner 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ScreenshotScanner 0.1.2
File Size Uploaded
screenshotscanner-0.1.2.tar.gz 11.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ScreenshotScanner 0.1.2
File Interpreter ABI Platform
screenshotscanner-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 MB

Release files / screenshotscanner-0.1.2.tar.gz

Download URL screenshotscanner-0.1.2.tar.gz
Size 11.9 MB
Tags Source
SHA-256 checksum
How to use checksums
963ca8b56ac57c76cad3553b2541b67f72ad06e11a9b2522a2c28ce5fb0ad33d
BLAKE2b-256 checksum
How to use checksums
96f766610c1d5eb504eb1dbd0c32166cec61fdcd6a25dfa256fccef352baaf23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / screenshotscanner-0.1.2-py3-none-any.whl

Download URL screenshotscanner-0.1.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52cdf188e20b5cf1b3b43480fb6c088659d70ca85564ddff3028cd1f1f921eb6
BLAKE2b-256 checksum
How to use checksums
aac7b5d3af58ba51edfc0db75c0ccaab93b46600f3983e2955c2e68c7ebd5b0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page