# kassoulet/tiff-reducer architecture

> Architecture diagram of the GitHub repository kassoulet/tiff-reducer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kassoulet/tiff-reducer
- Repository: https://github.com/kassoulet/tiff-reducer

## Overview

tiff-reducer is a Rust CLI for compressing, analyzing, and wiping TIFF images while preserving metadata. The main workflow is a user invoking a subcommand, after which the CLI processes TIFF data and produces an optimized or transformed file. Compression supports multiple codecs, lossy and extreme selection, quantization, tiling, overviews, checksums, and batch processing. The graph reflects README-documented capabilities and sampled module references; gaps in the main source excerpt limit detail about internal dispatch and data flow.

Main entry points: [`src/main.rs`](https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs) (Command interface), [`src/ffi.rs`](https://github.com/kassoulet/tiff-reducer/blob/main/src/ffi.rs) (libtiff bindings), [`src/wipe.rs`](https://github.com/kassoulet/tiff-reducer/blob/main/src/wipe.rs) (Content wiping), [`src/metadata.rs`](https://github.com/kassoulet/tiff-reducer/blob/main/src/metadata.rs) (Metadata copying)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_cli["Command interface<br/>[main.rs]"]
end

subgraph group_image["Image processing"]
  node_compress["TIFF compression<br/>[main.rs]"]
  node_analyze["Metadata analysis<br/>[main.rs]"]
  node_wipe["Content wiping<br/>[wipe.rs]"]
  node_quantize["Pixel quantization<br/>[quantize.rs]"]
  node_metadata["Metadata copying<br/>[metadata.rs]"]
end

subgraph group_internals["TIFF internals"]
  node_ffi["libtiff bindings<br/>[ffi.rs]"]
end

node_user(("User"))

node_user -->|"invokes"| node_cli
node_cli -->|"runs compression"| node_compress
node_cli -->|"runs analysis"| node_analyze
node_cli -->|"runs wipe"| node_wipe
node_cli -->|"references"| node_metadata
node_cli -->|"references"| node_quantize
node_cli -->|"imports"| node_ffi
node_metadata -->|"uses bindings"| node_ffi
node_wipe -->|"uses bindings"| node_ffi

click node_cli "https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs"
click node_compress "https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs"
click node_analyze "https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs"
click node_wipe "https://github.com/kassoulet/tiff-reducer/blob/main/src/wipe.rs"
click node_quantize "https://github.com/kassoulet/tiff-reducer/blob/main/src/quantize.rs"
click node_metadata "https://github.com/kassoulet/tiff-reducer/blob/main/src/metadata.rs"
click node_ffi "https://github.com/kassoulet/tiff-reducer/blob/main/src/ffi.rs"

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_user toneBlue
class node_compress,node_analyze,node_wipe,node_quantize,node_metadata toneAmber
class node_ffi toneMint
```

## Components

### CLI workflows

- [Command interface](https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs): `src/main.rs`

### Image processing

- [TIFF compression](https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs): `src/main.rs`
- [Metadata analysis](https://github.com/kassoulet/tiff-reducer/blob/main/src/main.rs): `src/main.rs`
- [Content wiping](https://github.com/kassoulet/tiff-reducer/blob/main/src/wipe.rs): `src/wipe.rs`
- [Pixel quantization](https://github.com/kassoulet/tiff-reducer/blob/main/src/quantize.rs): `src/quantize.rs`
- [Metadata copying](https://github.com/kassoulet/tiff-reducer/blob/main/src/metadata.rs): `src/metadata.rs`

### TIFF internals

- [libtiff bindings](https://github.com/kassoulet/tiff-reducer/blob/main/src/ffi.rs): `src/ffi.rs`

### Other components

- **User**

## Connections

- User → Command interface: invokes (evidence: `README.md`)
- Command interface → TIFF compression: runs compression (evidence: `README.md`)
- Command interface → Metadata analysis: runs analysis (evidence: `README.md`)
- Command interface → Content wiping: runs wipe (evidence: `README.md`)
- Command interface → Metadata copying: references (evidence: `src/main.rs`)
- Command interface → Pixel quantization: references (evidence: `src/main.rs`)
- Command interface → libtiff bindings: imports (evidence: `src/main.rs`)
- Metadata copying → libtiff bindings: uses bindings (evidence: `src/metadata.rs`)
- Content wiping → libtiff bindings: uses bindings (evidence: `src/wipe.rs`)
