# coderujwal3/image-forensic architecture

> Architecture diagram of the GitHub repository coderujwal3/image-forensic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coderujwal3/image-forensic
- Repository: https://github.com/coderujwal3/image-forensic

## Overview

forensic-image is a Python digital-image forensics library and CLI. Its principal workflow ingests and preserves image bytes, extracts container and metadata evidence, computes identity and similarity hashes, runs specialized forensic analyses, and presents findings as reports. The graph distinguishes those domain stages and includes the internal findings model. The source excerpts are partial; edges rely on shown calls, SOURCE INDEX references, or README capability descriptions, so unsampled implementation details are not inferred.

Main entry points: [`forensic_image/core/evidence.py`](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/evidence.py) (Image evidence), [`forensic_image/cli/main.py`](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/cli/main.py) (CLI commands), [`forensic_image/core/reader.py`](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/reader.py) (Safe binary reader), [`forensic_image/metadata/exif.py`](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/metadata/exif.py) (Metadata extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI commands<br/>[main.py]"]
  node_api["Python API<br/>[__init__.py]"]
end

subgraph group_evidence["Evidence handling"]
  node_image_evidence["Image evidence<br/>[evidence.py]"]
  node_safe_reader["Safe binary reader<br/>[reader.py]"]
  node_manifest["Evidence manifest<br/>[manifest.py]"]
  node_crypto_hash["Cryptographic hashes<br/>[cryptographic.py]"]
end

subgraph group_extraction["Image extraction"]
  node_format_detect["Format detection<br/>[detector.py]"]
  node_container_parsers["Container parsers<br/>[jpeg.py]"]
  node_png_parser["PNG parser<br/>[png.py]"]
  node_webp_parser["WebP parser<br/>[webp.py]"]
  node_metadata["Metadata extraction<br/>[exif.py]"]
  node_thumbnail["Thumbnail forensics<br/>[thumbnail.py]"]
end

subgraph group_analysis["Forensic analysis"]
  node_perceptual_hash["Perceptual hashes<br/>[perceptual.py]"]
  node_analyzer_registry["Analyzer registry<br/>[registry.py]"]
  node_quant_subsampling["JPEG quantization and subsampling<br/>[quantization.py]"]
  node_recompression["Recompression analysis<br/>[recompression.py]"]
  node_tampering["Tampering analysis<br/>[tampering.py]"]
  node_transformation["Transformation analysis<br/>[transformation.py]"]
  node_screenshot["Screenshot detection<br/>[screenshot.py]"]
  node_pixel["Experimental pixel analysis<br/>[pixel.py]"]
  node_provenance["Provenance timeline<br/>[provenance.py]"]
  node_profile_match["Reference profile matching<br/>[matcher.py]"]
end

subgraph group_output["Findings and reports"]
  node_findings["Findings model<br/>[findings.py]"]
  node_report_model["Forensic report<br/>[report.py]"]
  node_terminal_report["Terminal reporting<br/>[terminal.py]"]
  node_json_report["JSON reporting<br/>[json_reporter.py]"]
  node_html_report["HTML reporting<br/>[html_reporter.py]"]
end

node_analyst(("Analyst"))

node_analyst -->|"runs commands"| node_cli
node_analyst -->|"calls API"| node_api
node_cli -->|"analyzes evidence"| node_image_evidence
node_api -->|"creates evidence"| node_image_evidence
node_image_evidence -->|"hashes bytes"| node_crypto_hash
node_image_evidence -->|"records custody"| node_manifest
node_image_evidence -->|"detects format"| node_format_detect
node_image_evidence -->|"parses containers"| node_container_parsers
node_image_evidence -->|"parses containers"| node_png_parser
node_image_evidence -->|"parses containers"| node_webp_parser
node_image_evidence -->|"extracts metadata"| node_metadata
node_image_evidence -->|"computes similarity"| node_perceptual_hash
node_image_evidence -->|"dispatches analyzers"| node_analyzer_registry
node_image_evidence -->|"runs analysis"| node_quant_subsampling
node_image_evidence -->|"runs analysis"| node_recompression
node_image_evidence -->|"runs analysis"| node_tampering
node_image_evidence -->|"runs analysis"| node_transformation
node_image_evidence -->|"runs analysis"| node_screenshot
node_image_evidence -->|"runs analysis"| node_pixel
node_image_evidence -->|"runs analysis"| node_provenance
node_image_evidence -->|"matches profiles"| node_profile_match
node_container_parsers -->|"reads bytes"| node_safe_reader
node_png_parser -->|"reads bytes"| node_safe_reader
node_webp_parser -->|"reads bytes"| node_safe_reader
node_metadata -->|"reads metadata"| node_safe_reader
node_metadata -->|"extracts thumbnails"| node_thumbnail
node_image_evidence -->|"adds findings"| node_findings
node_image_evidence -->|"builds report"| node_report_model
node_report_model -->|"renders report"| node_terminal_report
node_report_model -->|"renders report"| node_html_report
node_cli -->|"exports JSON"| node_json_report
node_cli -->|"prints findings"| node_terminal_report
node_cli -->|"exports HTML"| node_html_report

click node_cli "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/cli/main.py"
click node_api "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/__init__.py"
click node_image_evidence "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/evidence.py"
click node_safe_reader "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/reader.py"
click node_manifest "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/manifest.py"
click node_crypto_hash "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/hashing/cryptographic.py"
click node_format_detect "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/detector.py"
click node_container_parsers "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/jpeg.py"
click node_png_parser "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/png.py"
click node_webp_parser "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/webp.py"
click node_metadata "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/metadata/exif.py"
click node_thumbnail "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/metadata/thumbnail.py"
click node_perceptual_hash "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/hashing/perceptual.py"
click node_analyzer_registry "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/registry.py"
click node_quant_subsampling "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/quantization.py"
click node_recompression "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/recompression.py"
click node_tampering "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/tampering.py"
click node_transformation "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/transformation.py"
click node_screenshot "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/screenshot.py"
click node_pixel "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/pixel.py"
click node_provenance "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/provenance.py"
click node_profile_match "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/profiles/matcher.py"
click node_findings "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/findings.py"
click node_report_model "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/report.py"
click node_terminal_report "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/reporting/terminal.py"
click node_json_report "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/reporting/json_reporter.py"
click node_html_report "https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/reporting/html_reporter.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_api toneBlue
class node_image_evidence,node_safe_reader,node_manifest,node_crypto_hash toneAmber
class node_format_detect,node_container_parsers,node_png_parser,node_webp_parser,node_metadata,node_thumbnail toneMint
class node_perceptual_hash,node_analyzer_registry,node_quant_subsampling,node_recompression,node_tampering,node_transformation,node_screenshot,node_pixel,node_provenance,node_profile_match toneRose
class node_findings,node_report_model,node_terminal_report,node_json_report,node_html_report,node_analyst toneIndigo
```

## Components

### Entry points

- [CLI commands](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/cli/main.py): `forensic_image/cli/main.py`
- [Python API](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/__init__.py): `forensic_image/__init__.py`

### Evidence handling

- [Image evidence](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/evidence.py): `forensic_image/core/evidence.py`
- [Safe binary reader](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/reader.py): `forensic_image/core/reader.py`
- [Evidence manifest](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/manifest.py): `forensic_image/core/manifest.py`
- [Cryptographic hashes](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/hashing/cryptographic.py): `forensic_image/hashing/cryptographic.py`

### Image extraction

- [Format detection](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/detector.py): `forensic_image/formats/detector.py`
- [Container parsers](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/jpeg.py): `forensic_image/formats/jpeg.py`
- [PNG parser](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/png.py): `forensic_image/formats/png.py`
- [WebP parser](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/formats/webp.py): `forensic_image/formats/webp.py`
- [Metadata extraction](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/metadata/exif.py): `forensic_image/metadata/exif.py`
- [Thumbnail forensics](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/metadata/thumbnail.py): `forensic_image/metadata/thumbnail.py`

### Forensic analysis

- [Perceptual hashes](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/hashing/perceptual.py): `forensic_image/hashing/perceptual.py`
- [Analyzer registry](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/registry.py): `forensic_image/forensics/registry.py`
- [JPEG quantization and subsampling](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/quantization.py): `forensic_image/forensics/quantization.py`
- [Recompression analysis](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/recompression.py): `forensic_image/forensics/recompression.py`
- [Tampering analysis](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/tampering.py): `forensic_image/forensics/tampering.py`
- [Transformation analysis](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/transformation.py): `forensic_image/forensics/transformation.py`
- [Screenshot detection](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/screenshot.py): `forensic_image/forensics/screenshot.py`
- [Experimental pixel analysis](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/pixel.py): `forensic_image/forensics/pixel.py`
- [Provenance timeline](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/forensics/provenance.py): `forensic_image/forensics/provenance.py`
- [Reference profile matching](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/profiles/matcher.py): `forensic_image/profiles/matcher.py`

### Findings and reports

- [Findings model](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/findings.py): `forensic_image/core/findings.py`
- [Forensic report](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/core/report.py): `forensic_image/core/report.py`
- [Terminal reporting](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/reporting/terminal.py): `forensic_image/reporting/terminal.py`
- [JSON reporting](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/reporting/json_reporter.py): `forensic_image/reporting/json_reporter.py`
- [HTML reporting](https://github.com/coderujwal3/image-forensic/blob/main/forensic_image/reporting/html_reporter.py): `forensic_image/reporting/html_reporter.py`

### Other components

- **Analyst**

## Connections

- Analyst → CLI commands: runs commands (evidence: `README.md`)
- Analyst → Python API: calls API (evidence: `README.md`)
- CLI commands → Image evidence: analyzes evidence (evidence: `forensic_image/cli/main.py`)
- Python API → Image evidence: creates evidence (evidence: `forensic_image/__init__.py`)
- Image evidence → Cryptographic hashes: hashes bytes (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Evidence manifest: records custody (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Format detection: detects format (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Container parsers: parses containers (evidence: `forensic_image/core/evidence.py`)
- Image evidence → PNG parser: parses containers (evidence: `forensic_image/core/evidence.py`)
- Image evidence → WebP parser: parses containers (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Metadata extraction: extracts metadata (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Perceptual hashes: computes similarity (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Analyzer registry: dispatches analyzers (evidence: `forensic_image/__init__.py`)
- Image evidence → JPEG quantization and subsampling: runs analysis (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Recompression analysis: runs analysis (evidence: `README.md`)
- Image evidence → Tampering analysis: runs analysis (evidence: `README.md`)
- Image evidence → Transformation analysis: runs analysis (evidence: `README.md`)
- Image evidence → Screenshot detection: runs analysis (evidence: `README.md`)
- Image evidence → Experimental pixel analysis: runs analysis (evidence: `README.md`)
- Image evidence → Provenance timeline: runs analysis (evidence: `README.md`)
- Image evidence → Reference profile matching: matches profiles (evidence: `forensic_image/core/evidence.py`)
- Container parsers → Safe binary reader: reads bytes (evidence: `forensic_image/formats/jpeg.py`)
- PNG parser → Safe binary reader: reads bytes (evidence: `forensic_image/formats/png.py`)
- WebP parser → Safe binary reader: reads bytes (evidence: `forensic_image/formats/webp.py`)
- Metadata extraction → Safe binary reader: reads metadata (evidence: `forensic_image/metadata/exif.py`)
- Metadata extraction → Thumbnail forensics: extracts thumbnails (evidence: `README.md`)
- Image evidence → Findings model: adds findings (evidence: `forensic_image/core/evidence.py`)
- Image evidence → Forensic report: builds report (evidence: `forensic_image/core/evidence.py`)
- Forensic report → Terminal reporting: renders report (evidence: `forensic_image/core/report.py`)
- Forensic report → HTML reporting: renders report (evidence: `forensic_image/core/report.py`)
- CLI commands → JSON reporting: exports JSON (evidence: `forensic_image/cli/main.py`)
- CLI commands → Terminal reporting: prints findings (evidence: `forensic_image/cli/main.py`)
- CLI commands → HTML reporting: exports HTML (evidence: `forensic_image/cli/main.py`)
