# prash5t/design-compare-tool architecture

> Architecture diagram of the GitHub repository prash5t/design-compare-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prash5t/design-compare-tool
- Repository: https://github.com/prash5t/design-compare-tool

## Overview

Design Comparison Tool is a Flask web app for comparing Figma screenshots with screenshots of built screens. The main workflow is: a user selects two images in the web interface, the browser submits them to Flask, the app preprocesses and analyzes the images, and the browser displays a similarity score and annotated comparison image. The backend also supports bulk screen comparisons and serving generated images. The README documents the visual-comparison capabilities; the sampled source shows their implementation in app.py. The template and CSS were not sampled, so their internal behavior is not inferred.

Main entry points: [`app.py`](https://github.com/prash5t/design-compare-tool/blob/main/app.py) (Image comparison), [`static/js/script.js`](https://github.com/prash5t/design-compare-tool/blob/main/static/js/script.js) (Upload and results UI), [`templates/index.html`](https://github.com/prash5t/design-compare-tool/blob/main/templates/index.html) (Comparison page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_page["Comparison page<br/>[index.html]"]
  node_browser["Upload and results UI<br/>[script.js]"]
end

subgraph group_requests["Comparison requests"]
  node_single["Single upload handler<br/>[app.py]"]
  node_bulk["Bulk upload handler<br/>[app.py]"]
  node_imagefiles["Uploaded images<br/>[app.py]"]
  node_retrieve["Image retrieval route<br/>[app.py]"]
end

subgraph group_analysis["Image analysis"]
  node_comparison["Image comparison<br/>[app.py]"]
  node_preprocess["Image preprocessing<br/>[app.py]"]
  node_ssim["SSIM and differences<br/>[app.py]"]
  node_visualize["Difference visualization<br/>[app.py]"]
  node_results["Comparison results<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_page
node_page -.->|"loads interface"| node_browser
node_browser -->|"posts images"| node_single
node_single -->|"saves images"| node_imagefiles
node_single -->|"calls"| node_comparison
node_bulk -->|"saves images"| node_imagefiles
node_bulk -->|"calls"| node_comparison
node_comparison -->|"reads and resizes"| node_preprocess
node_comparison -->|"computes differences"| node_ssim
node_comparison -->|"annotates images"| node_visualize
node_comparison -->|"writes result image"| node_results
node_single -->|"returns result"| node_browser
node_browser -->|"links to image"| node_retrieve
node_retrieve -->|"serves image"| node_results
node_single -->|"renders page"| node_page

click node_page "https://github.com/prash5t/design-compare-tool/blob/main/templates/index.html"
click node_browser "https://github.com/prash5t/design-compare-tool/blob/main/static/js/script.js"
click node_single "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_bulk "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_imagefiles "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_comparison "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_preprocess "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_ssim "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_visualize "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_results "https://github.com/prash5t/design-compare-tool/blob/main/app.py"
click node_retrieve "https://github.com/prash5t/design-compare-tool/blob/main/app.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_page,node_browser,node_user toneBlue
class node_single,node_bulk,node_imagefiles,node_retrieve toneAmber
class node_comparison,node_preprocess,node_ssim,node_visualize,node_results toneMint
```

## Components

### Web interface

- [Comparison page](https://github.com/prash5t/design-compare-tool/blob/main/templates/index.html): `templates/index.html`
- [Upload and results UI](https://github.com/prash5t/design-compare-tool/blob/main/static/js/script.js): `static/js/script.js`

### Comparison requests

- [Single upload handler](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [Bulk upload handler](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [Uploaded images](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [Image retrieval route](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`

### Image analysis

- [Image comparison](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [Image preprocessing](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [SSIM and differences](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [Difference visualization](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`
- [Comparison results](https://github.com/prash5t/design-compare-tool/blob/main/app.py): `app.py`

### Other components

- **User**

## Connections

- User → Comparison page: uses (evidence: `README.md`)
- Comparison page → Upload and results UI: loads interface
- Upload and results UI → Single upload handler: posts images (evidence: `static/js/script.js`)
- Single upload handler → Uploaded images: saves images (evidence: `app.py`)
- Single upload handler → Image comparison: calls (evidence: `app.py`)
- Bulk upload handler → Uploaded images: saves images (evidence: `app.py`)
- Bulk upload handler → Image comparison: calls (evidence: `app.py`)
- Image comparison → Image preprocessing: reads and resizes (evidence: `app.py`)
- Image comparison → SSIM and differences: computes differences (evidence: `app.py`)
- Image comparison → Difference visualization: annotates images (evidence: `app.py`)
- Image comparison → Comparison results: writes result image (evidence: `app.py`)
- Single upload handler → Upload and results UI: returns result (evidence: `static/js/script.js`)
- Upload and results UI → Image retrieval route: links to image (evidence: `static/js/script.js`)
- Image retrieval route → Comparison results: serves image (evidence: `app.py`)
- Single upload handler → Comparison page: renders page (evidence: `app.py`)
