# stillware/imgfetch architecture

> Architecture diagram of the GitHub repository stillware/imgfetch, 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/stillware/imgfetch
- Repository: https://github.com/stillware/imgfetch

## Overview

ImgFetch is a Chrome/Edge extension for finding and downloading page images and capturing screenshots. The main workflow starts with a page scan or Smart Download, presents image choices in the popup, then validates and saves selections individually or as a ZIP. A separate screenshot workflow captures visible, selected, or full-page content; users can review parts, annotate or crop captures, and save or copy results. The graph includes documented capabilities whose implementation details were not sampled; those links cite the README rather than implying inspected call paths.

Main entry points: [`background/service-worker.js`](https://github.com/stillware/imgfetch/blob/main/background/service-worker.js) (Extension worker), [`pages/parts.js`](https://github.com/stillware/imgfetch/blob/main/pages/parts.js) (Parts review), [`popup/popup.js`](https://github.com/stillware/imgfetch/blob/main/popup/popup.js) (Popup controls), [`content/scanner.js`](https://github.com/stillware/imgfetch/blob/main/content/scanner.js) (Page scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Image discovery"]
  node_popup["Popup controls<br/>[popup.js]"]
  node_scanner["Page scanner<br/>[scanner.js]"]
  node_overlay["Scan overlay<br/>[overlay.js]"]
end

subgraph group_downloads["Download processing"]
  node_worker["Extension worker<br/>[service-worker.js]"]
  node_source_urls["Source URL rules<br/>[urls.js]"]
  node_download_queue["Download queue<br/>[queue.js]"]
  node_format_export["Format and ZIP export<br/>[offscreen.js]"]
end

subgraph group_captures["Screenshot workflow"]
  node_capture_planner["Full-page planner"]
  node_capture_storage["Capture storage rules<br/>[capture-storage.js]"]
  node_idb[("Capture database<br/>[idb.js]")]
  node_parts["Parts review<br/>[parts.js]"]
  node_capture_page["Capture page<br/>[capture.js]"]
  node_annotator["Screenshot editor<br/>[annotate.js]"]
end

subgraph group_shared["Shared services"]
  node_settings["Settings<br/>[settings.js]"]
  node_options["Settings interface<br/>[options.js]"]
  node_capture_io["Capture access<br/>[capture-io.js]"]
  node_copy_shot["Screenshot copying<br/>[copy-shot.js]"]
  node_history["Download history<br/>[history.js]"]
end

node_user(("User"))
node_page["Web page"]

node_user -->|"chooses images"| node_page
node_user -->|"opens controls"| node_popup
node_page -->|"scans page"| node_scanner
node_scanner -->|"presents results"| node_overlay
node_popup -.->|"requests downloads"| node_worker
node_worker -->|"validates sources"| node_source_urls
node_worker -.->|"tracks downloads"| node_download_queue
node_worker -.->|"requests conversion"| node_format_export
node_worker -->|"reads settings"| node_settings
node_user -->|"configures preferences"| node_options
node_options -->|"updates settings"| node_settings
node_user -->|"starts capture"| node_capture_page
node_worker -->|"plans full-page parts"| node_capture_planner
node_worker -.->|"applies retention rules"| node_capture_storage
node_worker -->|"stores captures"| node_idb
node_capture_page -->|"reviews page parts"| node_parts
node_parts -->|"saves or discards"| node_worker
node_parts -->|"loads capture data"| node_capture_io
node_capture_io -->|"reads capture records"| node_idb
node_parts -->|"opens editor"| node_annotator
node_annotator -->|"copies screenshot"| node_copy_shot
node_worker -.->|"records download history"| node_history

click node_popup "https://github.com/stillware/imgfetch/blob/main/popup/popup.js"
click node_scanner "https://github.com/stillware/imgfetch/blob/main/content/scanner.js"
click node_overlay "https://github.com/stillware/imgfetch/blob/main/content/overlay.js"
click node_worker "https://github.com/stillware/imgfetch/blob/main/background/service-worker.js"
click node_source_urls "https://github.com/stillware/imgfetch/blob/main/core/urls.js"
click node_download_queue "https://github.com/stillware/imgfetch/blob/main/core/queue.js"
click node_format_export "https://github.com/stillware/imgfetch/blob/main/offscreen/offscreen.js"
click node_settings "https://github.com/stillware/imgfetch/blob/main/core/settings.js"
click node_options "https://github.com/stillware/imgfetch/blob/main/options/options.js"
click node_capture_planner "https://github.com/stillware/imgfetch/blob/main/core/fullpage-capture.js"
click node_capture_storage "https://github.com/stillware/imgfetch/blob/main/core/capture-storage.js"
click node_idb "https://github.com/stillware/imgfetch/blob/main/background/idb.js"
click node_parts "https://github.com/stillware/imgfetch/blob/main/pages/parts.js"
click node_capture_page "https://github.com/stillware/imgfetch/blob/main/pages/capture.js"
click node_annotator "https://github.com/stillware/imgfetch/blob/main/pages/annotate.js"
click node_capture_io "https://github.com/stillware/imgfetch/blob/main/shared/capture-io.js"
click node_copy_shot "https://github.com/stillware/imgfetch/blob/main/shared/copy-shot.js"
click node_history "https://github.com/stillware/imgfetch/blob/main/core/history.js"

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_popup,node_scanner,node_overlay,node_user toneBlue
class node_worker,node_source_urls,node_download_queue,node_format_export toneAmber
class node_capture_planner,node_capture_storage,node_idb,node_parts,node_capture_page,node_annotator toneMint
class node_settings,node_options,node_capture_io,node_copy_shot,node_history toneRose
class node_page toneIndigo
```

## Components

### Image discovery

- [Popup controls](https://github.com/stillware/imgfetch/blob/main/popup/popup.js): `popup/popup.js`
- [Page scanner](https://github.com/stillware/imgfetch/blob/main/content/scanner.js): `content/scanner.js`
- [Scan overlay](https://github.com/stillware/imgfetch/blob/main/content/overlay.js): `content/overlay.js`

### Download processing

- [Extension worker](https://github.com/stillware/imgfetch/blob/main/background/service-worker.js): `background/service-worker.js`
- [Source URL rules](https://github.com/stillware/imgfetch/blob/main/core/urls.js): `core/urls.js`
- [Download queue](https://github.com/stillware/imgfetch/blob/main/core/queue.js): `core/queue.js`
- [Format and ZIP export](https://github.com/stillware/imgfetch/blob/main/offscreen/offscreen.js): `offscreen/offscreen.js`

### Screenshot workflow

- [Full-page planner](https://github.com/stillware/imgfetch/blob/main/core/fullpage-capture.js): `core/fullpage-capture.js`
- [Capture storage rules](https://github.com/stillware/imgfetch/blob/main/core/capture-storage.js): `core/capture-storage.js`
- [Capture database](https://github.com/stillware/imgfetch/blob/main/background/idb.js): `background/idb.js`
- [Parts review](https://github.com/stillware/imgfetch/blob/main/pages/parts.js): `pages/parts.js`
- [Capture page](https://github.com/stillware/imgfetch/blob/main/pages/capture.js): `pages/capture.js`
- [Screenshot editor](https://github.com/stillware/imgfetch/blob/main/pages/annotate.js): `pages/annotate.js`

### Shared services

- [Settings](https://github.com/stillware/imgfetch/blob/main/core/settings.js): `core/settings.js`
- [Settings interface](https://github.com/stillware/imgfetch/blob/main/options/options.js): `options/options.js`
- [Capture access](https://github.com/stillware/imgfetch/blob/main/shared/capture-io.js): `shared/capture-io.js`
- [Screenshot copying](https://github.com/stillware/imgfetch/blob/main/shared/copy-shot.js): `shared/copy-shot.js`
- [Download history](https://github.com/stillware/imgfetch/blob/main/core/history.js): `core/history.js`

### Other components

- **User**
- **Web page**

## Connections

- User → Web page: chooses images (evidence: `README.md`)
- User → Popup controls: opens controls (evidence: `README.md`)
- Web page → Page scanner: scans page (evidence: `README.md`)
- Page scanner → Scan overlay: presents results (evidence: `README.md`)
- Popup controls → Extension worker: requests downloads
- Extension worker → Source URL rules: validates sources (evidence: `background/service-worker.js`)
- Extension worker → Download queue: tracks downloads (evidence: `background/service-worker.js`)
- Extension worker → Format and ZIP export: requests conversion
- Extension worker → Settings: reads settings (evidence: `background/service-worker.js`)
- User → Settings interface: configures preferences (evidence: `README.md`)
- Settings interface → Settings: updates settings (evidence: `options/options.js`)
- User → Capture page: starts capture (evidence: `README.md`)
- Extension worker → Full-page planner: plans full-page parts (evidence: `background/service-worker.js`)
- Extension worker → Capture storage rules: applies retention rules (evidence: `background/service-worker.js`)
- Extension worker → Capture database: stores captures (evidence: `background/service-worker.js`)
- Capture page → Parts review: reviews page parts (evidence: `README.md`)
- Parts review → Extension worker: saves or discards (evidence: `pages/parts.js`)
- Parts review → Capture access: loads capture data (evidence: `pages/parts.js`)
- Capture access → Capture database: reads capture records (evidence: `shared/capture-io.js`)
- Parts review → Screenshot editor: opens editor (evidence: `pages/parts.js`)
- Screenshot editor → Screenshot copying: copies screenshot (evidence: `pages/annotate.js`)
- Extension worker → Download history: records download history (evidence: `background/service-worker.js`)
