# ciromattia/kcc architecture

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

- Interactive diagram: https://gitdiagram.com/ciromattia/kcc
- Repository: https://github.com/ciromattia/kcc

## Overview

KCC converts comics and manga into device-optimized ebooks, PDFs, archives, or image folders. The main workflow is to provide source files through the desktop interface or command-line entry point, process pages for a target device, and produce a selected output format. The README also highlights panel splitting/merging and semi-automatic spread handling. Connections reflect the shown startup dispatch, SOURCE INDEX references, and README statements; several conversion internals are unsampled, so their detailed control flow is not inferred.

Main entry points: [`kindlecomicconverter/comic2ebook.py`](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comic2ebook.py) (Ebook conversion), [`kindlecomicconverter/KCC_gui.py`](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_gui.py) (Desktop GUI), [`kindlecomicconverter/startup.py`](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/startup.py) (Startup dispatch), [`kindlecomicconverter/image.py`](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/image.py) (Page parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_launcher["App launcher<br/>[kcc.py]"]
  node_startup["Startup dispatch<br/>[startup.py]"]
end

subgraph group_interface["Desktop interface"]
  node_desktop["Desktop GUI<br/>[KCC_gui.py]"]
  node_main_ui["Main UI layout<br/>[KCC_ui.py]"]
  node_metadata_editor["Metadata editor UI<br/>[KCC_ui_editor.py]"]
end

subgraph group_conversion["Conversion"]
  node_ebook_converter["Ebook conversion<br/>[comic2ebook.py]"]
  node_panel_tools["Panel split and merge<br/>[comic2panel.py]"]
end

subgraph group_processing["Page processing"]
  node_page_parser["Page parsing<br/>[image.py]"]
  node_device_profiles["Device profiles<br/>[kindle.py]"]
  node_page_number_crop["Page number crop"]
  node_interpanel_crop["Inter-panel crop"]
  node_crop_helpers["Crop helpers<br/>[common_crop.py]"]
  node_rainbow_filter["Rainbow artifact removal"]
end

subgraph group_support["Formats and metadata"]
  node_archive["Comic archive access<br/>[comicarchive.py]"]
  node_metadata["Comic metadata<br/>[metadata.py]"]
  node_pdf_extract["PDF image extraction<br/>[pdfjpgextract.py]"]
  node_shared["Shared utilities<br/>[shared.py]"]
end

node_user(("Comic reader"))
node_source["Comic sources"]
node_converted_book["Converted output"]

node_user -->|"selects"| node_source
node_user -->|"drops files"| node_desktop
node_launcher -->|"starts"| node_startup
node_startup -->|"launches"| node_desktop
node_desktop -->|"sets up"| node_main_ui
node_desktop -->|"uses"| node_metadata_editor
node_desktop -->|"dispatches conversion"| node_ebook_converter
node_source -->|"provides input"| node_ebook_converter
node_startup -->|"dispatches CLI"| node_ebook_converter
node_startup -->|"dispatches CLI"| node_panel_tools
node_ebook_converter -->|"invokes for webtoons"| node_panel_tools
node_ebook_converter -->|"uses"| node_page_parser
node_ebook_converter -->|"uses"| node_device_profiles
node_ebook_converter -->|"uses"| node_archive
node_ebook_converter -->|"uses"| node_metadata
node_ebook_converter -->|"uses"| node_pdf_extract
node_page_parser -->|"uses"| node_page_number_crop
node_page_parser -->|"uses"| node_interpanel_crop
node_page_parser -->|"uses"| node_rainbow_filter
node_page_number_crop -->|"uses"| node_crop_helpers
node_interpanel_crop -->|"uses"| node_crop_helpers
node_ebook_converter -->|"produces"| node_converted_book

click node_launcher "https://github.com/ciromattia/kcc/blob/master/kcc.py"
click node_startup "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/startup.py"
click node_desktop "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_gui.py"
click node_main_ui "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_ui.py"
click node_metadata_editor "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_ui_editor.py"
click node_ebook_converter "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comic2ebook.py"
click node_panel_tools "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comic2panel.py"
click node_page_parser "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/image.py"
click node_device_profiles "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/kindle.py"
click node_page_number_crop "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/page_number_crop_alg.py"
click node_interpanel_crop "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/inter_panel_crop_alg.py"
click node_crop_helpers "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/common_crop.py"
click node_rainbow_filter "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/rainbow_artifacts_eraser.py"
click node_archive "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comicarchive.py"
click node_metadata "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/metadata.py"
click node_pdf_extract "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/pdfjpgextract.py"
click node_shared "https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/shared.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_launcher,node_startup toneBlue
class node_desktop,node_main_ui,node_metadata_editor toneAmber
class node_ebook_converter,node_panel_tools toneMint
class node_page_parser,node_device_profiles,node_page_number_crop,node_interpanel_crop,node_crop_helpers,node_rainbow_filter toneRose
class node_archive,node_metadata,node_pdf_extract,node_shared,node_user,node_source,node_converted_book toneIndigo
```

## Components

### Entry points

- [App launcher](https://github.com/ciromattia/kcc/blob/master/kcc.py): `kcc.py`
- [Startup dispatch](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/startup.py): `kindlecomicconverter/startup.py`

### Desktop interface

- [Desktop GUI](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_gui.py): `kindlecomicconverter/KCC_gui.py`
- [Main UI layout](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_ui.py): `kindlecomicconverter/KCC_ui.py`
- [Metadata editor UI](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/KCC_ui_editor.py): `kindlecomicconverter/KCC_ui_editor.py`

### Conversion

- [Ebook conversion](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comic2ebook.py): `kindlecomicconverter/comic2ebook.py`
- [Panel split and merge](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comic2panel.py): `kindlecomicconverter/comic2panel.py`

### Page processing

- [Page parsing](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/image.py): `kindlecomicconverter/image.py`
- [Device profiles](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/kindle.py): `kindlecomicconverter/kindle.py`
- [Page number crop](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/page_number_crop_alg.py): `kindlecomicconverter/page_number_crop_alg.py`
- [Inter-panel crop](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/inter_panel_crop_alg.py): `kindlecomicconverter/inter_panel_crop_alg.py`
- [Crop helpers](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/common_crop.py): `kindlecomicconverter/common_crop.py`
- [Rainbow artifact removal](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/rainbow_artifacts_eraser.py): `kindlecomicconverter/rainbow_artifacts_eraser.py`

### Formats and metadata

- [Comic archive access](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/comicarchive.py): `kindlecomicconverter/comicarchive.py`
- [Comic metadata](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/metadata.py): `kindlecomicconverter/metadata.py`
- [PDF image extraction](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/pdfjpgextract.py): `kindlecomicconverter/pdfjpgextract.py`
- [Shared utilities](https://github.com/ciromattia/kcc/blob/master/kindlecomicconverter/shared.py): `kindlecomicconverter/shared.py`

### Other components

- **Comic reader**
- **Comic sources**
- **Converted output**

## Connections

- Comic reader → Comic sources: selects (evidence: `README.md`)
- Comic reader → Desktop GUI: drops files (evidence: `README.md`)
- App launcher → Startup dispatch: starts (evidence: `kcc.py`)
- Startup dispatch → Desktop GUI: launches (evidence: `kindlecomicconverter/startup.py`)
- Desktop GUI → Main UI layout: sets up (evidence: `kindlecomicconverter/KCC_gui.py`)
- Desktop GUI → Metadata editor UI: uses (evidence: `kindlecomicconverter/KCC_gui.py`)
- Desktop GUI → Ebook conversion: dispatches conversion (evidence: `kindlecomicconverter/KCC_gui.py`)
- Comic sources → Ebook conversion: provides input (evidence: `README.md`)
- Startup dispatch → Ebook conversion: dispatches CLI (evidence: `kindlecomicconverter/startup.py`)
- Startup dispatch → Panel split and merge: dispatches CLI (evidence: `kindlecomicconverter/startup.py`)
- Ebook conversion → Panel split and merge: invokes for webtoons (evidence: `kindlecomicconverter/comic2ebook.py`)
- Ebook conversion → Page parsing: uses (evidence: `kindlecomicconverter/comic2ebook.py`)
- Ebook conversion → Device profiles: uses (evidence: `kindlecomicconverter/comic2ebook.py`)
- Ebook conversion → Comic archive access: uses (evidence: `kindlecomicconverter/comic2ebook.py`)
- Ebook conversion → Comic metadata: uses (evidence: `kindlecomicconverter/comic2ebook.py`)
- Ebook conversion → PDF image extraction: uses (evidence: `kindlecomicconverter/comic2ebook.py`)
- Page parsing → Page number crop: uses (evidence: `kindlecomicconverter/image.py`)
- Page parsing → Inter-panel crop: uses (evidence: `kindlecomicconverter/image.py`)
- Page parsing → Rainbow artifact removal: uses (evidence: `kindlecomicconverter/image.py`)
- Page number crop → Crop helpers: uses (evidence: `kindlecomicconverter/page_number_crop_alg.py`)
- Inter-panel crop → Crop helpers: uses (evidence: `kindlecomicconverter/inter_panel_crop_alg.py`)
- Ebook conversion → Converted output: produces (evidence: `README.md`)
