# kyleduo/tinypng4mac architecture

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

- Interactive diagram: https://gitdiagram.com/kyleduo/tinypng4mac
- Repository: https://github.com/kyleduo/tinypng4mac

## Overview

Tiny Image is a macOS client for compressing and converting images through TinyPNG. Users add images by dragging files into the app or invoking the Finder service; the app discovers image files, creates tasks, and submits them for compression. Results are downloaded and saved according to overwrite or Save As settings, with completed tasks available for opening or restoring. The README also documents format selection, concurrency, metadata-preservation settings, and a cached monthly usage count. Some wiring is inferred only where documented capabilities exceed the sampled source.

Main entry points: [`TinyPNG4Mac/TinyPNG4Mac/vms/MainViewModel.swift`](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/vms/MainViewModel.swift) (Main view model), [`TinyPNG4Mac/TinyPNG4Mac/client/TPClient.swift`](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/client/TPClient.swift) (TinyPNG client), [`TinyPNG4Mac/TinyPNG4Mac/views/DropFileView.swift`](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/views/DropFileView.swift) (Drag and drop), [`TinyPNG4Mac/TinyPNG4Mac/TinyPNG4MacApp.swift`](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/TinyPNG4MacApp.swift) (App and services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Image intake"]
  node_drop["Drag and drop<br/>[DropFileView.swift]"]
  node_app["App and services"]
  node_fileutils["Image discovery<br/>[FileUtils.swift]"]
end

subgraph group_workflow["Task workflow"]
  node_viewmodel["Main view model"]
  node_task["Image task state<br/>[TaskInfo.swift]"]
  node_queue["Task queue<br/>[TPQueue.swift]"]
end

subgraph group_service["Compression service"]
  node_client["TinyPNG client<br/>[TPClient.swift]"]
  node_conversion["Format handling<br/>[ImageType.swift]"]
end

subgraph group_interface["App interface"]
  node_mainview["Main window"]
  node_settingsview["Settings window<br/>[SettingsView.swift]"]
  node_taskrow["Task display<br/>[TaskRowView.swift]"]
end

subgraph group_configuration["Configuration"]
  node_config["App configuration<br/>[AppConfig.swift]"]
  node_context["Shared app context<br/>[AppContext.swift]"]
end

node_user(("User"))
node_finder(("Finder services"))
node_tinypng{{"TinyPNG API"}}
node_filesystem["Local image files"]

node_user -->|"drops images"| node_drop
node_drop -->|"discovers images"| node_fileutils
node_drop -->|"updates drop state"| node_mainview
node_finder -->|"selects files"| node_app
node_app -->|"discovers images"| node_fileutils
node_app -->|"creates tasks"| node_viewmodel
node_mainview -->|"creates and manages"| node_viewmodel
node_viewmodel -->|"resolves paths"| node_fileutils
node_viewmodel -->|"reads settings"| node_config
node_viewmodel -->|"creates tasks"| node_task
node_viewmodel -->|"enqueues tasks"| node_queue
node_queue -->|"dispatches tasks"| node_client
node_client -->|"uploads and requests"| node_tinypng
node_client -->|"encodes conversion"| node_conversion
node_client -->|"reads and saves"| node_filesystem
node_filesystem -->|"supplies image data"| node_client
node_client -->|"updates task state"| node_task
node_client -->|"reports task updates"| node_viewmodel
node_viewmodel -->|"supplies task state"| node_taskrow
node_viewmodel -->|"publishes workflow state"| node_mainview
node_user -->|"changes preferences"| node_settingsview
node_settingsview -->|"stores preferences"| node_config
node_context -->|"holds configuration"| node_config
node_viewmodel -->|"restores originals"| node_filesystem

click node_drop "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/views/DropFileView.swift"
click node_app "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/TinyPNG4MacApp.swift"
click node_mainview "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/windows/MainContentView.swift"
click node_settingsview "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/windows/SettingsView.swift"
click node_taskrow "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/views/TaskRowView.swift"
click node_viewmodel "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/vms/MainViewModel.swift"
click node_fileutils "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/utils/FileUtils.swift"
click node_task "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/model/TaskInfo.swift"
click node_queue "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/client/TPQueue.swift"
click node_client "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/client/TPClient.swift"
click node_conversion "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/model/ImageType.swift"
click node_config "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/app/AppConfig.swift"
click node_context "https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/app/AppContext.swift"

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_drop,node_app,node_fileutils,node_user toneBlue
class node_viewmodel,node_task,node_queue toneAmber
class node_client,node_conversion,node_tinypng toneMint
class node_mainview,node_settingsview,node_taskrow toneRose
class node_config,node_context,node_finder,node_filesystem toneIndigo
```

## Components

### Image intake

- [Drag and drop](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/views/DropFileView.swift): `TinyPNG4Mac/TinyPNG4Mac/views/DropFileView.swift`
- [App and services](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/TinyPNG4MacApp.swift): `TinyPNG4Mac/TinyPNG4Mac/TinyPNG4MacApp.swift`
- [Image discovery](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/utils/FileUtils.swift): `TinyPNG4Mac/TinyPNG4Mac/utils/FileUtils.swift`

### Task workflow

- [Main view model](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/vms/MainViewModel.swift): `TinyPNG4Mac/TinyPNG4Mac/vms/MainViewModel.swift`
- [Image task state](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/model/TaskInfo.swift): `TinyPNG4Mac/TinyPNG4Mac/model/TaskInfo.swift`
- [Task queue](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/client/TPQueue.swift): `TinyPNG4Mac/TinyPNG4Mac/client/TPQueue.swift`

### Compression service

- [TinyPNG client](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/client/TPClient.swift): `TinyPNG4Mac/TinyPNG4Mac/client/TPClient.swift`
- [Format handling](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/model/ImageType.swift): `TinyPNG4Mac/TinyPNG4Mac/model/ImageType.swift`

### App interface

- [Main window](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/windows/MainContentView.swift): `TinyPNG4Mac/TinyPNG4Mac/windows/MainContentView.swift`
- [Settings window](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/windows/SettingsView.swift): `TinyPNG4Mac/TinyPNG4Mac/windows/SettingsView.swift`
- [Task display](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/views/TaskRowView.swift): `TinyPNG4Mac/TinyPNG4Mac/views/TaskRowView.swift`

### Configuration

- [App configuration](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/app/AppConfig.swift): `TinyPNG4Mac/TinyPNG4Mac/app/AppConfig.swift`
- [Shared app context](https://github.com/kyleduo/tinypng4mac/blob/master/TinyPNG4Mac/TinyPNG4Mac/app/AppContext.swift): `TinyPNG4Mac/TinyPNG4Mac/app/AppContext.swift`

### Other components

- **User**
- **Finder services**
- **TinyPNG API**
- **Local image files**

## Connections

- User → Drag and drop: drops images
- Drag and drop → Image discovery: discovers images
- Drag and drop → Main window: updates drop state
- Finder services → App and services: selects files
- App and services → Image discovery: discovers images
- App and services → Main view model: creates tasks
- Main window → Main view model: creates and manages
- Main view model → Image discovery: resolves paths
- Main view model → App configuration: reads settings
- Main view model → Image task state: creates tasks
- Main view model → Task queue: enqueues tasks
- Task queue → TinyPNG client: dispatches tasks
- TinyPNG client → TinyPNG API: uploads and requests
- TinyPNG client → Format handling: encodes conversion
- TinyPNG client → Local image files: reads and saves
- Local image files → TinyPNG client: supplies image data
- TinyPNG client → Image task state: updates task state
- TinyPNG client → Main view model: reports task updates
- Main view model → Task display: supplies task state
- Main view model → Main window: publishes workflow state
- User → Settings window: changes preferences
- Settings window → App configuration: stores preferences
- Shared app context → App configuration: holds configuration
- Main view model → Local image files: restores originals
