# theradicaloptimist/imagemixer architecture

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

- Interactive diagram: https://gitdiagram.com/theradicaloptimist/imagemixer
- Repository: https://github.com/theradicaloptimist/imagemixer

## Overview

imagemixer is a small interactive Python application for combining two images. Its workflow prompts for image paths and a mixing mode, creates either a checkerboard-style pixel mix or a threshold-mask color composite, then previews the pixel mix and optionally saves it. A separate percentage-blend function exists but is not connected to the mode-selection workflow. The evidence is limited to the README and the two supplied source files.

Main entry points: [`fonctions.py`](https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py) (Image and mode selection), [`main.py`](https://github.com/theradicaloptimist/imagemixer/blob/main/main.py) (CLI entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_cli["CLI entry<br/>[main.py]"]
  node_selection["Image and mode selection<br/>[fonctions.py]"]
end

subgraph group_mixing["Image mixing"]
  node_pixel_mix["Pixel pattern mix<br/>[fonctions.py]"]
  node_color_mix["Color mask mix<br/>[fonctions.py]"]
  node_blend["Percentage blend<br/>[fonctions.py]"]
end

subgraph group_output["Preview and save"]
  node_terminal_preview["Terminal preview<br/>[main.py]"]
  node_preview_save["Preview and save helpers<br/>[fonctions.py]"]
end

node_user(("User"))
node_images["Image files"]
node_result["Mixed image"]

node_user -->|"starts"| node_cli
node_cli -->|"calls"| node_selection
node_user -->|"provides choices"| node_selection
node_images -->|"provides paths"| node_selection
node_selection -->|"dispatches"| node_pixel_mix
node_selection -->|"dispatches"| node_color_mix
node_pixel_mix -->|"opens"| node_images
node_color_mix -->|"opens"| node_images
node_blend -->|"opens"| node_images
node_pixel_mix -->|"calls preview and save"| node_preview_save
node_pixel_mix -->|"returns"| node_result
node_color_mix -->|"returns"| node_result
node_blend -->|"returns"| node_result
node_cli -->|"renders result"| node_terminal_preview
node_terminal_preview -->|"displays"| node_user
node_preview_save -->|"saves optionally"| node_result

click node_cli "https://github.com/theradicaloptimist/imagemixer/blob/main/main.py"
click node_selection "https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py"
click node_pixel_mix "https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py"
click node_color_mix "https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py"
click node_blend "https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py"
click node_terminal_preview "https://github.com/theradicaloptimist/imagemixer/blob/main/main.py"
click node_preview_save "https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.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_selection,node_user toneBlue
class node_pixel_mix,node_color_mix,node_blend toneAmber
class node_terminal_preview,node_preview_save toneMint
class node_images,node_result toneIndigo
```

## Components

### User interaction

- [CLI entry](https://github.com/theradicaloptimist/imagemixer/blob/main/main.py): `main.py`
- [Image and mode selection](https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py): `fonctions.py`

### Image mixing

- [Pixel pattern mix](https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py): `fonctions.py`
- [Color mask mix](https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py): `fonctions.py`
- [Percentage blend](https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py): `fonctions.py`

### Preview and save

- [Terminal preview](https://github.com/theradicaloptimist/imagemixer/blob/main/main.py): `main.py`
- [Preview and save helpers](https://github.com/theradicaloptimist/imagemixer/blob/main/fonctions.py): `fonctions.py`

### Other components

- **User**
- **Image files**
- **Mixed image**

## Connections

- User → CLI entry: starts (evidence: `main.py`)
- CLI entry → Image and mode selection: calls (evidence: `main.py`)
- User → Image and mode selection: provides choices (evidence: `fonctions.py`)
- Image files → Image and mode selection: provides paths (evidence: `fonctions.py`)
- Image and mode selection → Pixel pattern mix: dispatches (evidence: `fonctions.py`)
- Image and mode selection → Color mask mix: dispatches (evidence: `fonctions.py`)
- Pixel pattern mix → Image files: opens (evidence: `fonctions.py`)
- Color mask mix → Image files: opens (evidence: `fonctions.py`)
- Percentage blend → Image files: opens (evidence: `fonctions.py`)
- Pixel pattern mix → Preview and save helpers: calls preview and save (evidence: `fonctions.py`)
- Pixel pattern mix → Mixed image: returns (evidence: `fonctions.py`)
- Color mask mix → Mixed image: returns (evidence: `fonctions.py`)
- Percentage blend → Mixed image: returns (evidence: `fonctions.py`)
- CLI entry → Terminal preview: renders result (evidence: `main.py`)
- Terminal preview → User: displays (evidence: `main.py`)
- Preview and save helpers → Mixed image: saves optionally (evidence: `fonctions.py`)
