<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Performing Deep Fake Detection

## Error Level Analysis (ELA)

### Pillow Implementation

```python
from PIL import Image, ImageChops

original = Image.open('suspect.jpg')
original.save('/tmp/temp.jpg', 'JPEG', quality=95)
resaved = Image.open('/tmp/temp.jpg')
diff = ImageChops.difference(original, resaved)
```

### Interpretation

| ELA Result | Meaning |
|---|---|
| Uniform brightness | Consistent compression — likely unmodified |
| Bright spots in regions | Different compression level — possible edit |
| Bright edges only | Normal edge enhancement artifacts |

## ExifTool Forensic Tags

| Tag | Manipulation Indicator |
|---|---|
| `Software` | Editing tool used (Photoshop, GIMP) |
| `HistoryAction` | Edit history trail |
| `HistorySoftwareAgent` | Tools used in edits |
| `ModifyDate` vs `CreateDate` | Time gap indicates modification |
| Missing `Make`/`Model` | Not from a camera (possibly generated) |

## Online Detection Services

| Service | URL | Method |
|---|---|---|
| FotoForensics | `fotoforensics.com` | ELA, metadata, JPEG analysis |
| Hive Moderation | `hivemoderation.com` | AI-powered detection |
| InVID WeVerify | `weverify.eu` | Video verification toolkit |
| Sensity AI | `sensity.ai` | Deepfake detection API |

## Agent Script

```bash
node agent.js ela --input suspect.jpg --quality 95
node agent.js metadata-check --input image.jpg
node agent.js video-frames --input video.mp4 --interval 1
node agent.js face-check --input portrait.jpg
node agent.js --self-test
```
