I’ve packaged a complete, ready‑to‑run project that checks images for likely tampering using:
- EXIF metadata inspection
- ELA (Error Level Analysis)
- Noise residual heatmap
- Copy–move clone detection (ORB feature clustering)
- JPEG “ghosts” curve + ghost variance map
- A friendly heuristic suspicion score + verdict
💡 Reality check: no tool can prove an image is fake or real. This is a triage toolkit that gives you signals and a confidence score—great for first-pass vetting and learning.
⬇️ Grab the project
Unzip it, and you’ll see:
image-forensics-lab/
├─ app.py # Streamlit web app
├─ forensic.py # Analysis routines (ELA, noise, copy–move, JPEG ghosts, scoring)
├─ cli.py # Command-line tool
├─ requirements.txt # Dependencies
├─ README.md # Quick guide
└─ LICENSE # MIT
🚀 Run the Website (Streamlit)
- (Recommended) create a virtual env
python -m venv .venv
# macOS/Linux:
source .venv/bin/activate
# Windows (PowerShell):
.venv\Scripts\Activate.ps1
- Install dependencies
pip install -r requirements.txt
- Launch the app
streamlit run app.py
- Open the local URL it prints (usually http://localhost:8501), upload an image, and explore:
- Original + EXIF (editing software/date flags if present)
- ELA heatmap for localized recompression
- Noise residual for texture inconsistencies
- Copy–move overlay showing repeated patterns with consistent displacement
- JPEG Ghosts curve + variance map
- Suspicion Score (0–1) with a clear verdict:
- < 0.35 → Likely Unaltered (low suspicion)
- 0.35–0.65 → Inconclusive (medium suspicion)
- > 0.65 → Possibly Doctored (high suspicion)
You can also download a JSON report of all metrics from the app.
⚙️ Prefer the Command Line?
python cli.py –image /path/to/image.jpg –report out.json
Outputs a one-line verdict + a detailed JSON report.
✨ What’s going on under the hood?
- EXIF: reads metadata (dates, camera, software strings); many PNGs/screenshots won’t have EXIF.
- ELA: recompresses to JPEG and measures differences—strong localized artifacts can hint at edits.
- Noise residual: high‑pass residual + patch heterogeneity to spot odd texture patterns.
- Copy–move: ORB keypoints are matched within the image; a strong cluster of similar displacements can reveal cloning.
- JPEG ghosts: recompress at several qualities, plot error curve, and compute a per‑pixel variance map across qualities—regions that behave differently can be suspicious.
- Heuristic score: blends signals (ELA, copy–move, noise heterogeneity, JPEG variance) into a 0–1 score with a simple verdict.
🧭 Pro tips for better reads
- Use the highest-resolution original you can get (avoid screenshots and re-uploads).
- If the image is a PNG derived from a JPEG, ELA/JPEG tests weaken.
- Heavy filters/compression can push false positives—always pair with context.
- This is an educational tool; for high-stakes analysis, consult professional forensic workflows.
🌈 You’ve got this!
You now have a cheerful, no‑nonsense forensics starter kit—perfect for quick checks, demos, and learning.
If you want me to tailor the UI (brand colors, your logo, extra tests, or a hosted deployment guide), say the word and we’ll power it up! 🚀