๐ Image Forensics Toolkit
๐ต๏ธโโ๏ธ Digital Image Forensics Toolkit
Classical (non-AI) methods for authenticating images. These tools do not "classify fake vs real" with a neural network; they look for physical and signal-processing inconsistencies left behind by editing software and generative models.
Which tool should I use?
| Your question | Tool |
|---|---|
| Was a region pasted in from another photo? | CFA + JPEG Ghost |
| Does the image have a consistent compression history? | JPEG Ghost |
| Does every pixel come from the same camera sensor? | PRNU |
| Do all shadows point to a single light source? | Shadows |
Suggested workflow
- CFA full-image scan โ fast overview of regions with a broken interpolation grid.
- JPEG Ghost detection โ check for double-compression splices.
- PRNU detection (if you have camera reference photos) โ the strongest sensor-level evidence.
- Shadows โ for outdoor scenes with visible straight shadows.
Key principle
No single forensic cue is conclusive. Triangulate: two independent methods pointing at the same region is much stronger evidence than any one method alone. Every tab documents its own limitations โ read them before drawing conclusions.
Open source
Apache License 2.0 โ see LICENSE and NOTICE (the PRNU backend is a
Python port of J. Fridrich's reference MATLAB toolbox). Citations: see
CITATION.cff.
๐จ Color Filter Array (CFA) Analysis
What this detects
Camera pipelines interpolate the raw Bayer mosaic, leaving a regular pixel grid. Spliced or copy-moved patches โ or AI-generated content โ break this grid. This tool maps where the CFA grid is strong and where it is weak.
How to use it
- Upload a JPG/PNG image.
- Use Full-image scan for an overview, or Patch analysis to inspect a specific region.
How to interpret
- Patch mode: bright periodic peaks in the Fourier spectrum โ authentic CFA grid. Missing/blurry peaks โ the patch was resampled or never came from a camera sensor.
- Full-image mode: red blocks score < 90% of the image's median periodicity โ suspicious regions to inspect further.
Limitations
- Fails on screenshots, renders, heavy denoising, simplistic resampling, or images saved through social platforms (re-CFA'd by the platform).
- Scores are relative to the image itself โ an entirely synthetic image can look self-consistent.
- This is a localization aid, not a verdict. Cross-check with the JPEG Ghost and PRNU tabs.
References
[1] Popescu & Farid, Detecting Tampering and Interpolation Artifacts in Images, IEEE TIP 2005.
๐ป JPEG Ghost Detection
What this detects
Images that were saved as JPEG more than once โ e.g. a region spliced in from a different JPEG file โ keep a 'ghost' of the earlier compression. Recompressing the image at known quality factors and measuring the error reveals regions with a different compression history.
How to interpret
- Detection tab: study the estimated previous-QF map. A uniform map = one compression history = no ghost. A distinct plateau/rectangle = region with a different history = likely splice.
- Simulator tab: builds a synthetic splice so you can see what a real ghost looks like before interpreting real evidence.
Limitations
- Requires a JPEG-derived input; PNG screenshots and single-save images show no ghost.
- If the forged image is re-encoded once more after the splice, the ghost can disappear.
- A ghost proves different compression history, not forgery per se โ combine with CFA/PRNU evidence.
References
[1] Farid, Exposing Digital Forgeries from JPEG Ghosts, IEEE TIFS 2009.
Builds a synthetic forgery from your image: the background is recompressed at QF1, the selected patch is pasted from the original, and the result is saved at QF2 โ then the ghost analysis runs on it. Use this to calibrate your eye.
๐ธ PRNU Camera-Fingerprint Analysis
What this detects
Every camera sensor injects a unique noise pattern (PRNU) into its photos. Comparing an image's noise against a known camera fingerprint reveals which regions came from that camera โ and which did not (splices, AI content).
Workflow
- Fingerprint extraction (once per camera): upload 10โ30 original photos from the camera โ download the
fingerprint.npy. - Detection: upload the fingerprint + the suspect image โ get a block-wise PCE map and an automatic verdict.
How to interpret
- PCE โฅ 50 in a block = strong evidence the block belongs to that sensor.
- Authentic image โ most blocks glow. Spliced region โ dark hole in the PCE map.
- No match anywhere โ wrong camera, or the image was denoised / re-encoded / AI-generated.
Limitations
- Requires original (unprocessed) reference photos.
- Fails after denoising, heavy recompression, cropping, or social-media re-encoding.
- A fingerprint match shows origin, not content integrity โ a matched photo can still be a scene manipulation (e.g. object removal).
References
[1] Lukas, Fridrich & Goljan, Digital Camera Identification from PRNU, IEEE TIFS 2007. [2] Goljan, Filler & Fridrich, Large Scale Test of Sensor Fingerprint Camera Identification, SPIE 2009.
Upload 10โ30 original photos taken with the same camera (same resolution & orientation, no screenshots / social-media re-uploads). The tool averages their noise residuals into a camera fingerprint you can reuse in the Detection tab.
๐๐ Shadow Consistency Analysis ๐๐๐
What this checks
Shadows cast by a single light source converge to the same vanishing point. Trace the edges of two different shadows (one group per color); if the computed vanishing points disagree, the lighting is physically inconsistent โ evidence of splicing or AI generation.
How to use
- Upload the image.
- Click Start Yellow, then trace shadow group A: click two points per shadow edge (โฅ 2 lines).
- Click Start Red, trace shadow group B the same way.
- Press Compute vanishing points and read the verdict.
Limitations
- Curved shadows, perspective-distorted ground planes and near-parallel edges reduce accuracy.
- Works best outdoors with strong sun (point-light approximation) and straight shadow boundaries.
- Perspective โ lighting: this validates geometry, so confirm anomalies with CFA/JPEG-ghost/PRNU evidence.
References
Classical projective-geometry vanishing-point estimation; shadow-consistency checks as used in image-authenticity analysis (e.g. Farid, A Survey of Image Forgery Detection, IEEE Signal Processing Magazine, 2009).