# azarrias/sprite-sheet-splitter architecture

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

- Interactive diagram: https://gitdiagram.com/azarrias/sprite-sheet-splitter
- Repository: https://github.com/azarrias/sprite-sheet-splitter

## Overview

Sprite Sheet Splitter is a desktop tool for loading PNG/TGA sprite sheets, previewing configurable slices, selecting frames into an ordered animation, and previewing playback. The runtime flow begins at the module entry point, loads an image through the GUI shell, and uses the session model and Pillow imaging for slice and animation views. The README documents editing, zoom, chooser behavior, and safety limits; unsampled GUI callbacks and dialog details are represented only where the excerpts or README support them.

Main entry points: [`src/sprite_sheet_splitter/app.py`](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/app.py) (GUI Shell), [`src/sprite_sheet_splitter/model.py`](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py) (Editing Session), [`src/sprite_sheet_splitter/imaging.py`](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py) (Sheet Renderer), [`src/sprite_sheet_splitter/__main__.py`](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/__main__.py) (Module Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop UI"]
  node_entry["Module Entry<br/>[__main__.py]"]
  node_gui["GUI Shell<br/>[app.py]"]
  node_chooser["Image Chooser<br/>[app.py]"]
end

subgraph group_workflow["Sprite Workflow"]
  node_image["Loaded Image<br/>[imaging.py]"]
  node_session["Editing Session<br/>[model.py]"]
  node_geometry["Slice Geometry<br/>[model.py]"]
  node_selection["Frame Selection<br/>[model.py]"]
  node_animation["Animation Timing<br/>[model.py]"]
end

subgraph group_render["Image Rendering"]
  node_sheet["Sheet Renderer<br/>[imaging.py]"]
  node_crop["Region Sampling<br/>[imaging.py]"]
  node_preview["Animation Renderer<br/>[imaging.py]"]
  node_display["Display Scaling<br/>[imaging.py]"]
end

node_user(("User"))
node_desktop_services["Dear ImGui / Dialogs"]

node_user -->|"launches"| node_entry
node_entry -->|"runs"| node_gui
node_gui -->|"requests image"| node_chooser
node_chooser -->|"opens dialog"| node_desktop_services
node_gui -->|"loads image"| node_image
node_gui -->|"updates"| node_session
node_session -->|"generates regions"| node_geometry
node_gui -.->|"records clicks"| node_selection
node_session -->|"tests hits"| node_selection
node_selection -->|"resets playback"| node_animation
node_gui -->|"renders sheet"| node_sheet
node_sheet -->|"samples regions"| node_crop
node_gui -->|"renders preview"| node_preview
node_preview -->|"samples frame"| node_crop
node_gui -->|"scales image"| node_display
node_sheet -->|"reads layout"| node_session
node_preview -->|"reads playback"| node_session
node_gui -->|"draws interface"| node_desktop_services
node_animation -->|"advances frames"| node_session

click node_entry "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/__main__.py"
click node_gui "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/app.py"
click node_chooser "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/app.py"
click node_image "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py"
click node_session "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py"
click node_geometry "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py"
click node_selection "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py"
click node_animation "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py"
click node_sheet "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py"
click node_crop "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py"
click node_preview "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py"
click node_display "https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.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_entry,node_gui,node_chooser,node_user,node_desktop_services toneBlue
class node_image,node_session,node_geometry,node_selection,node_animation toneAmber
class node_sheet,node_crop,node_preview,node_display toneMint
```

## Components

### Desktop UI

- [Module Entry](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/__main__.py): `src/sprite_sheet_splitter/__main__.py`
- [GUI Shell](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/app.py): `src/sprite_sheet_splitter/app.py`
- [Image Chooser](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/app.py): `src/sprite_sheet_splitter/app.py`

### Sprite Workflow

- [Loaded Image](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py): `src/sprite_sheet_splitter/imaging.py`
- [Editing Session](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py): `src/sprite_sheet_splitter/model.py`
- [Slice Geometry](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py): `src/sprite_sheet_splitter/model.py`
- [Frame Selection](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py): `src/sprite_sheet_splitter/model.py`
- [Animation Timing](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/model.py): `src/sprite_sheet_splitter/model.py`

### Image Rendering

- [Sheet Renderer](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py): `src/sprite_sheet_splitter/imaging.py`
- [Region Sampling](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py): `src/sprite_sheet_splitter/imaging.py`
- [Animation Renderer](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py): `src/sprite_sheet_splitter/imaging.py`
- [Display Scaling](https://github.com/azarrias/sprite-sheet-splitter/blob/master/src/sprite_sheet_splitter/imaging.py): `src/sprite_sheet_splitter/imaging.py`

### Other components

- **User**
- **Dear ImGui / Dialogs**

## Connections

- User → Module Entry: launches (evidence: `README.md`)
- Module Entry → GUI Shell: runs (evidence: `src/sprite_sheet_splitter/__main__.py`)
- GUI Shell → Image Chooser: requests image (evidence: `README.md`)
- Image Chooser → Dear ImGui / Dialogs: opens dialog (evidence: `src/sprite_sheet_splitter/app.py`)
- GUI Shell → Loaded Image: loads image (evidence: `src/sprite_sheet_splitter/app.py`)
- GUI Shell → Editing Session: updates (evidence: `src/sprite_sheet_splitter/app.py`)
- Editing Session → Slice Geometry: generates regions (evidence: `src/sprite_sheet_splitter/model.py`)
- GUI Shell → Frame Selection: records clicks (evidence: `src/sprite_sheet_splitter/app.py`)
- Editing Session → Frame Selection: tests hits (evidence: `src/sprite_sheet_splitter/model.py`)
- Frame Selection → Animation Timing: resets playback (evidence: `src/sprite_sheet_splitter/model.py`)
- GUI Shell → Sheet Renderer: renders sheet (evidence: `src/sprite_sheet_splitter/app.py`)
- Sheet Renderer → Region Sampling: samples regions (evidence: `src/sprite_sheet_splitter/imaging.py`)
- GUI Shell → Animation Renderer: renders preview (evidence: `src/sprite_sheet_splitter/app.py`)
- Animation Renderer → Region Sampling: samples frame (evidence: `src/sprite_sheet_splitter/imaging.py`)
- GUI Shell → Display Scaling: scales image (evidence: `src/sprite_sheet_splitter/app.py`)
- Sheet Renderer → Editing Session: reads layout (evidence: `src/sprite_sheet_splitter/imaging.py`)
- Animation Renderer → Editing Session: reads playback (evidence: `src/sprite_sheet_splitter/imaging.py`)
- GUI Shell → Dear ImGui / Dialogs: draws interface (evidence: `src/sprite_sheet_splitter/app.py`)
- Animation Timing → Editing Session: advances frames (evidence: `src/sprite_sheet_splitter/model.py`)
