AMontiB
upload
e2472ac
---
title: Digital Image Forensics Toolkit
emoji: 🕵️‍♂️
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: "5.49.1"
app_file: app.py
pinned: false
---
# Digital Image Forensics Toolkit 🕵️‍♂️
This repository provides a collection of fundamental digital forensic algorithms designed to detect "cheap fakes"—image manipulations created with standard editing software like Photoshop or GIMP. The tools are implemented in Python and deployed on a local server using a [Gradio](https://www.gradio.app/) web interface.
These methods are effective for identifying traditional forgeries such as splicing, copy-move, and inconsistent lighting.
---
## Forensic Tools
This toolkit includes the following analysis methods:
### 🎨 Color Filter Array Analysis (`CFA.py`)
Analyzes artifacts introduced during the camera's raw image processing. Inconsistencies in the **Color Filter Array (CFA)** interpolation pattern can reveal areas that have been spliced from another image or copy-pasted within the same image (copy-move).
### 👻 JPEG Ghost Detection (`JPEG_Ghost.py`)
Detects forgeries by identifying regions within an image that were compressed with different **JPEG Quality Factors (QF)**. When an area from a different JPEG image is spliced in, it often carries the "ghost" of its original compression level, which this tool can reveal.
### 📸 PRNU Analysis (`PRNU.py`)
Uses the **Photo Response Non-Uniformity (PRNU)** pattern, a unique noise fingerprint inherent to every digital camera sensor. By comparing the PRNU of an image against a camera's known fingerprint, this tool can identify tampered regions (splicing, copy-move) that do not share the same origin. While typically used for source camera identification, local correlation analysis makes it a powerful forgery detector.
### ☀️ Shadow Consistency Analysis (`shadows.py`)
A utility for verifying geometric consistency of shadows in an image. By projecting vanishing points, it helps determine if all shadows correspond to a single, coherent light source. This method is based on principles of perspective and can be useful for analyzing both traditional manipulations and AI-generated images.
---
## ⚙️ Getting Started
### Prerequisites
* Python 3.10+
* pip
### Installation
pip install -r requirements.txt
### Run locally
python app.py
---
## 🚀 Deploying to Hugging Face Spaces
This repo is ready for a Gradio Space.
- Set the Space SDK to: Gradio
- Set the entry point to: `app.py`
- Hardware: CPU is sufficient
The `requirements.txt` already includes all dependencies.
---