# nathanatgit/shalielie architecture

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

- Interactive diagram: https://gitdiagram.com/nathanatgit/shalielie
- Repository: https://github.com/nathanatgit/shalielie

## Overview

Photographic Style Port patches compatible iPhone HEIC files so Apple Photos exposes Photographic Styles and Texture/Grain controls. Its main workflow accepts a photo, selects a donor profile, inspects and edits the HEIF item graph and metadata, then returns a patched file. The CLI is the reference implementation; the browser app performs the port locally, with optional image decoding for photo-specific tuning. The README also documents native-photo Texture/Grain handling and CLI inspection, profile listing, and donor extraction. The Python implementation is a single script; browser wiring is based on sampled imports and calls, while CLI internals are only partially sampled.

Main entry points: [`web/app.js`](https://github.com/nathanatgit/shalielie/blob/master/web/app.js) (Web interface), [`web/src/port.js`](https://github.com/nathanatgit/shalielie/blob/master/web/src/port.js) (Port orchestration), [`photographic_style_port.py`](https://github.com/nathanatgit/shalielie/blob/master/photographic_style_port.py) (CLI commands), [`web/src/decode.js`](https://github.com/nathanatgit/shalielie/blob/master/web/src/decode.js) (Image decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command-line tool"]
  node_python_cli["CLI commands"]
end

subgraph group_browser["Browser app"]
  node_web_app["Web interface<br/>[app.js]"]
  node_decoder["Image decoder<br/>[decode.js]"]
end

subgraph group_engine["HEIC processing"]
  node_browser_port["Port orchestration<br/>[port.js]"]
  node_heif_graph["HEIF graph surgery<br/>[heif.js]"]
  node_box_parser["Box parsing<br/>[box.js]"]
  node_texture["Texture metadata<br/>[texture.js]"]
  node_styles["Style metadata<br/>[styles.js]"]
  node_exif["EXIF handling<br/>[exif.js]"]
end

subgraph group_profiles["Donor profiles"]
  node_profile_index["Profile index<br/>[index.json]"]
  node_profile_loader["Profile loader<br/>[zip.js]"]
  node_donor_profiles["Donor profiles<br/>[45-15.zip]"]
end

node_cli_user(("CLI user"))
node_photo["Input HEIC"]
node_browser_user(("Browser user"))
node_local_file["Selected photo"]
node_patched_file["Patched HEIC"]
node_decoder_service["libheif decoder"]
node_python_tools["Encoder tools"]

node_cli_user -->|"runs command"| node_python_cli
node_photo -->|"reads file"| node_python_cli
node_python_cli -->|"writes result"| node_patched_file
node_python_cli -.->|"decodes and encodes"| node_python_tools
node_browser_user -->|"opens app"| node_web_app
node_local_file -->|"selects photo"| node_web_app
node_web_app -->|"fetches index"| node_profile_index
node_web_app -->|"loads profile"| node_profile_loader
node_profile_loader -->|"reads archive"| node_donor_profiles
node_web_app -->|"requests analysis"| node_decoder
node_decoder -.->|"loads decoder"| node_decoder_service
node_web_app -->|"patches photo"| node_browser_port
node_browser_port -->|"parses and edits"| node_heif_graph
node_heif_graph -->|"uses box operations"| node_box_parser
node_browser_port -->|"adds texture items"| node_texture
node_browser_port -->|"updates style data"| node_styles
node_browser_port -->|"handles EXIF data"| node_exif
node_browser_port -->|"returns patched bytes"| node_patched_file
node_web_app -->|"offers download or share"| node_patched_file

click node_python_cli "https://github.com/nathanatgit/shalielie/blob/master/photographic_style_port.py"
click node_web_app "https://github.com/nathanatgit/shalielie/blob/master/web/app.js"
click node_browser_port "https://github.com/nathanatgit/shalielie/blob/master/web/src/port.js"
click node_heif_graph "https://github.com/nathanatgit/shalielie/blob/master/web/src/heif.js"
click node_box_parser "https://github.com/nathanatgit/shalielie/blob/master/web/src/box.js"
click node_texture "https://github.com/nathanatgit/shalielie/blob/master/web/src/texture.js"
click node_styles "https://github.com/nathanatgit/shalielie/blob/master/web/src/styles.js"
click node_exif "https://github.com/nathanatgit/shalielie/blob/master/web/src/exif.js"
click node_decoder "https://github.com/nathanatgit/shalielie/blob/master/web/src/decode.js"
click node_profile_index "https://github.com/nathanatgit/shalielie/blob/master/web/profiles/index.json"
click node_profile_loader "https://github.com/nathanatgit/shalielie/blob/master/web/src/zip.js"
click node_donor_profiles "https://github.com/nathanatgit/shalielie/blob/master/web/profiles/45-15.zip"

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_python_cli,node_cli_user,node_browser_user toneBlue
class node_web_app,node_decoder toneAmber
class node_browser_port,node_heif_graph,node_box_parser,node_texture,node_styles,node_exif toneMint
class node_profile_index,node_profile_loader,node_donor_profiles toneRose
class node_photo,node_local_file,node_patched_file,node_decoder_service,node_python_tools toneIndigo
```

## Components

### Command-line tool

- [CLI commands](https://github.com/nathanatgit/shalielie/blob/master/photographic_style_port.py): `photographic_style_port.py`

### Browser app

- [Web interface](https://github.com/nathanatgit/shalielie/blob/master/web/app.js): `web/app.js`
- [Image decoder](https://github.com/nathanatgit/shalielie/blob/master/web/src/decode.js): `web/src/decode.js`

### HEIC processing

- [Port orchestration](https://github.com/nathanatgit/shalielie/blob/master/web/src/port.js): `web/src/port.js`
- [HEIF graph surgery](https://github.com/nathanatgit/shalielie/blob/master/web/src/heif.js): `web/src/heif.js`
- [Box parsing](https://github.com/nathanatgit/shalielie/blob/master/web/src/box.js): `web/src/box.js`
- [Texture metadata](https://github.com/nathanatgit/shalielie/blob/master/web/src/texture.js): `web/src/texture.js`
- [Style metadata](https://github.com/nathanatgit/shalielie/blob/master/web/src/styles.js): `web/src/styles.js`
- [EXIF handling](https://github.com/nathanatgit/shalielie/blob/master/web/src/exif.js): `web/src/exif.js`

### Donor profiles

- [Profile index](https://github.com/nathanatgit/shalielie/blob/master/web/profiles/index.json): `web/profiles/index.json`
- [Profile loader](https://github.com/nathanatgit/shalielie/blob/master/web/src/zip.js): `web/src/zip.js`
- [Donor profiles](https://github.com/nathanatgit/shalielie/blob/master/web/profiles/45-15.zip): `web/profiles/45-15.zip`

### Other components

- **CLI user**
- **Input HEIC**
- **Browser user**
- **Selected photo**
- **Patched HEIC**
- **libheif decoder**
- **Encoder tools**

## Connections

- CLI user → CLI commands: runs command
- Input HEIC → CLI commands: reads file
- CLI commands → Patched HEIC: writes result
- CLI commands → Encoder tools: decodes and encodes
- Browser user → Web interface: opens app
- Selected photo → Web interface: selects photo
- Web interface → Profile index: fetches index
- Web interface → Profile loader: loads profile
- Profile loader → Donor profiles: reads archive
- Web interface → Image decoder: requests analysis
- Image decoder → libheif decoder: loads decoder
- Web interface → Port orchestration: patches photo
- Port orchestration → HEIF graph surgery: parses and edits
- HEIF graph surgery → Box parsing: uses box operations
- Port orchestration → Texture metadata: adds texture items
- Port orchestration → Style metadata: updates style data
- Port orchestration → EXIF handling: handles EXIF data
- Port orchestration → Patched HEIC: returns patched bytes
- Web interface → Patched HEIC: offers download or share
