# wladekw/imgeffects architecture

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

- Interactive diagram: https://gitdiagram.com/wladekw/imgeffects
- Repository: https://github.com/wladekw/imgeffects

## Overview

ImgEffects Pro is a desktop image-effects editor: a user loads an image, adjusts resize and effect settings, processes it with a selected dithering method, previews the result, and can save it. The GUI also exposes grayscale, RGB, duotone colors, contrast, and zoom. The core provides Floyd–Steinberg diffusion and Bayer ordered dithering, backed by Bayer threshold matrices. Some GUI and core source was excerpted only partially; the Bayer GUI call and save implementation are therefore not asserted as verified relationships.

Main entry points: [`gui/src/main.rs`](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs) (Editor controls), [`core/src/dither/ordered/bayer.rs`](https://github.com/wladekw/imgeffects/blob/main/core/src/dither/ordered/bayer.rs) (Bayer dithering), [`core/src/dither/diffusion/floyd_steinberg.rs`](https://github.com/wladekw/imgeffects/blob/main/core/src/dither/diffusion/floyd_steinberg.rs) (Floyd–Steinberg), [`core/src/lib.rs`](https://github.com/wladekw/imgeffects/blob/main/core/src/lib.rs) (Core API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gui["Desktop editor"]
  node_controls["Editor controls<br/>[main.rs]"]
  node_image_input["Image loading<br/>[main.rs]"]
  node_preprocess["Image preparation<br/>[main.rs]"]
  node_dispatch["Algorithm dispatch<br/>[main.rs]"]
  node_preview["Image preview<br/>[main.rs]"]
  node_image_output["Image saving<br/>[main.rs]"]
end

subgraph group_core["Dithering core"]
  node_api["Core API<br/>[lib.rs]"]
  node_floyd["Floyd–Steinberg<br/>[floyd_steinberg.rs]"]
  node_bayer["Bayer dithering<br/>[bayer.rs]"]
  node_matrices["Bayer matrices<br/>[bayer_matrices.rs]"]
end

node_user(("User"))

node_user -->|"sets options"| node_controls
node_controls -->|"loads image"| node_image_input
node_controls -->|"triggers effects"| node_preprocess
node_preprocess -->|"dispatches image"| node_dispatch
node_dispatch -->|"calls dithering"| node_floyd
node_dispatch -.->|"selects method"| node_bayer
node_floyd -->|"exported through"| node_api
node_bayer -->|"exported through"| node_api
node_bayer -->|"reads thresholds"| node_matrices
node_dispatch -->|"updates result"| node_preview
node_controls -->|"requests save"| node_image_output

click node_controls "https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs"
click node_image_input "https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs"
click node_preprocess "https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs"
click node_dispatch "https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs"
click node_preview "https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs"
click node_image_output "https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs"
click node_api "https://github.com/wladekw/imgeffects/blob/main/core/src/lib.rs"
click node_floyd "https://github.com/wladekw/imgeffects/blob/main/core/src/dither/diffusion/floyd_steinberg.rs"
click node_bayer "https://github.com/wladekw/imgeffects/blob/main/core/src/dither/ordered/bayer.rs"
click node_matrices "https://github.com/wladekw/imgeffects/blob/main/core/src/dither/ordered/bayer_matrices.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_controls,node_image_input,node_preprocess,node_dispatch,node_preview,node_image_output,node_user toneBlue
class node_api,node_floyd,node_bayer,node_matrices toneAmber
```

## Components

### Desktop editor

- [Editor controls](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs): `gui/src/main.rs`
- [Image loading](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs): `gui/src/main.rs`
- [Image preparation](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs): `gui/src/main.rs`
- [Algorithm dispatch](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs): `gui/src/main.rs`
- [Image preview](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs): `gui/src/main.rs`
- [Image saving](https://github.com/wladekw/imgeffects/blob/main/gui/src/main.rs): `gui/src/main.rs`

### Dithering core

- [Core API](https://github.com/wladekw/imgeffects/blob/main/core/src/lib.rs): `core/src/lib.rs`
- [Floyd–Steinberg](https://github.com/wladekw/imgeffects/blob/main/core/src/dither/diffusion/floyd_steinberg.rs): `core/src/dither/diffusion/floyd_steinberg.rs`
- [Bayer dithering](https://github.com/wladekw/imgeffects/blob/main/core/src/dither/ordered/bayer.rs): `core/src/dither/ordered/bayer.rs`
- [Bayer matrices](https://github.com/wladekw/imgeffects/blob/main/core/src/dither/ordered/bayer_matrices.rs): `core/src/dither/ordered/bayer_matrices.rs`

### Other components

- **User**

## Connections

- User → Editor controls: sets options (evidence: `gui/src/main.rs`)
- Editor controls → Image loading: loads image (evidence: `gui/src/main.rs`)
- Editor controls → Image preparation: triggers effects (evidence: `gui/src/main.rs`)
- Image preparation → Algorithm dispatch: dispatches image (evidence: `gui/src/main.rs`)
- Algorithm dispatch → Floyd–Steinberg: calls dithering (evidence: `gui/src/main.rs`)
- Algorithm dispatch → Bayer dithering: selects method
- Floyd–Steinberg → Core API: exported through (evidence: `core/src/lib.rs`)
- Bayer dithering → Core API: exported through (evidence: `core/src/lib.rs`)
- Bayer dithering → Bayer matrices: reads thresholds (evidence: `core/src/dither/ordered/bayer.rs`)
- Algorithm dispatch → Image preview: updates result (evidence: `gui/src/main.rs`)
- Editor controls → Image saving: requests save (evidence: `gui/src/main.rs`)
