# haizhiya233/images-to-pdf architecture

> Architecture diagram of the GitHub repository haizhiya233/images-to-pdf, 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/haizhiya233/images-to-pdf
- Repository: https://github.com/haizhiya233/images-to-pdf

## Overview

Images-to-PDF is a Windows command-line/TUI tool that converts a folder’s images into a multi-page PDF, either as one job or as one PDF per image-containing subfolder. The principal flow is folder input → discovery and natural sorting → IrfanView configuration and invocation → PDFs in the output directory, with batch workers reporting status to the progress grid. The optional launcher fetches and verifies portable IrfanView before forwarding arguments to the converter. README documents these capabilities; omitted source excerpts limit certainty about some internal wiring.

Main entry points: [`folder_to_pdf.py`](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py) (PDF conversion), [`launcher.py`](https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py) (Portable launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversion["Conversion workflow"]
  node_cli["Interactive CLI<br/>[folder_to_pdf.py]"]
  node_dispatch["Mode dispatch<br/>[folder_to_pdf.py]"]
  node_discover["Image discovery<br/>[folder_to_pdf.py]"]
  node_sorting["Natural sorting<br/>[folder_to_pdf.py]"]
  node_batch["Batch coordinator<br/>[folder_to_pdf.py]"]
  node_workers["Parallel workers<br/>[folder_to_pdf.py]"]
  node_progress["Progress grid<br/>[folder_to_pdf.py]"]
  node_convert["PDF conversion<br/>[folder_to_pdf.py]"]
  node_config["PDF configuration<br/>[folder_to_pdf.py]"]
  node_command["Command builder<br/>[folder_to_pdf.py]"]
  node_output[("PDF output<br/>[folder_to_pdf.py]")]
end

subgraph group_portable["Portable runtime"]
  node_launcher["Portable launcher<br/>[launcher.py]"]
  node_download["Package download<br/>[launcher.py]"]
  node_verify["SHA-256 verification<br/>[launcher.py]"]
  node_extract["Package extraction<br/>[launcher.py]"]
  node_cache[("Temporary cache<br/>[launcher.py]")]
end

node_user(("User"))
node_irfan["IrfanView"]
node_official["Official download host"]

node_user -->|"provides folder"| node_cli
node_cli -->|"dispatches input"| node_dispatch
node_dispatch -->|"finds images"| node_discover
node_discover -->|"sorts naturally"| node_sorting
node_dispatch -->|"starts batch"| node_batch
node_batch -->|"submits jobs"| node_workers
node_workers -->|"converts folders"| node_convert
node_dispatch -->|"converts single"| node_convert
node_convert -->|"collects images"| node_discover
node_convert -->|"builds command"| node_command
node_command -->|"selects settings"| node_config
node_convert -->|"invokes"| node_irfan
node_irfan -->|"writes PDFs"| node_output
node_workers -->|"reports status"| node_progress
node_user -.->|"starts portable mode"| node_launcher
node_launcher -->|"requests packages"| node_download
node_download -->|"fetches from"| node_official
node_download -->|"checks hashes"| node_verify
node_download -->|"stores packages"| node_cache
node_launcher -->|"unpacks packages"| node_extract
node_extract -->|"installs in"| node_cache
node_launcher -->|"runs with path"| node_cli

click node_cli "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_dispatch "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_discover "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_sorting "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_batch "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_workers "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_progress "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_convert "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_config "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_command "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_output "https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py"
click node_launcher "https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py"
click node_download "https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py"
click node_verify "https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py"
click node_extract "https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py"
click node_cache "https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.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_dispatch,node_discover,node_sorting,node_batch,node_workers,node_progress,node_convert,node_config,node_command,node_output,node_user,node_irfan toneBlue
class node_launcher,node_download,node_verify,node_extract,node_cache toneAmber
class node_official toneIndigo
```

## Components

### Conversion workflow

- [Interactive CLI](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Mode dispatch](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Image discovery](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Natural sorting](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Batch coordinator](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Parallel workers](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Progress grid](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [PDF conversion](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [PDF configuration](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [Command builder](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`
- [PDF output](https://github.com/haizhiya233/images-to-pdf/blob/main/folder_to_pdf.py): `folder_to_pdf.py`

### Portable runtime

- [Portable launcher](https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py): `launcher.py`
- [Package download](https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py): `launcher.py`
- [SHA-256 verification](https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py): `launcher.py`
- [Package extraction](https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py): `launcher.py`
- [Temporary cache](https://github.com/haizhiya233/images-to-pdf/blob/main/launcher.py): `launcher.py`

### Other components

- **User**
- **IrfanView**
- **Official download host**

## Connections

- User → Interactive CLI: provides folder
- Interactive CLI → Mode dispatch: dispatches input
- Mode dispatch → Image discovery: finds images
- Image discovery → Natural sorting: sorts naturally
- Mode dispatch → Batch coordinator: starts batch
- Batch coordinator → Parallel workers: submits jobs
- Parallel workers → PDF conversion: converts folders
- Mode dispatch → PDF conversion: converts single
- PDF conversion → Image discovery: collects images
- PDF conversion → Command builder: builds command
- Command builder → PDF configuration: selects settings
- PDF conversion → IrfanView: invokes
- IrfanView → PDF output: writes PDFs
- Parallel workers → Progress grid: reports status
- User → Portable launcher: starts portable mode
- Portable launcher → Package download: requests packages
- Package download → Official download host: fetches from
- Package download → SHA-256 verification: checks hashes
- Package download → Temporary cache: stores packages
- Portable launcher → Package extraction: unpacks packages
- Package extraction → Temporary cache: installs in
- Portable launcher → Interactive CLI: runs with path
