# syedanazish-debug/image-preparing-lab architecture

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

- Interactive diagram: https://gitdiagram.com/syedanazish-debug/image-preparing-lab
- Repository: https://github.com/syedanazish-debug/image-preparing-lab

## Overview

Image Preparing Lab is a small Streamlit image-preparation prototype. The user uploads an image, reviews its dimensions and megapixels, validates crop coordinates, and crops it. The app measures the crop and, when it is below the 5 MP target, resizes it, encodes a quality-95 JPEG, and offers it for download. The graph follows the sampled app and processor code; no persistent storage or separate external processing service is shown.

Main entry points: [`app.py`](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/app.py) (Upload and workflow), [`image_processor.py`](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py) (Target resizing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Streamlit app"]
  node_app["Upload and workflow<br/>[app.py]"]
  node_jpeg["JPEG export<br/>[app.py]"]
end

subgraph group_processing["Image processing"]
  node_measure["Megapixel calculation<br/>[image_processor.py]"]
  node_validate["Crop validation<br/>[image_processor.py]"]
  node_crop["Image cropping<br/>[image_processor.py]"]
  node_resize["Target resizing<br/>[image_processor.py]"]
  node_scale["Scale calculation<br/>[image_processor.py]"]
end

node_user(("Image user"))

node_user -->|"uploads image"| node_app
node_app -->|"calculates megapixels"| node_measure
node_app -->|"validates coordinates"| node_validate
node_app -->|"crops image"| node_crop
node_app -->|"resizes if needed"| node_resize
node_resize -->|"calculates scale"| node_scale
node_app -->|"encodes JPEG"| node_jpeg
node_app -->|"offers download"| node_user

click node_app "https://github.com/syedanazish-debug/image-preparing-lab/blob/main/app.py"
click node_measure "https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py"
click node_validate "https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py"
click node_crop "https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py"
click node_resize "https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py"
click node_scale "https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py"
click node_jpeg "https://github.com/syedanazish-debug/image-preparing-lab/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_app,node_jpeg,node_user toneBlue
class node_measure,node_validate,node_crop,node_resize,node_scale toneAmber
```

## Components

### Streamlit app

- [Upload and workflow](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/app.py): `app.py`
- [JPEG export](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/app.py): `app.py`

### Image processing

- [Megapixel calculation](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py): `image_processor.py`
- [Crop validation](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py): `image_processor.py`
- [Image cropping](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py): `image_processor.py`
- [Target resizing](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py): `image_processor.py`
- [Scale calculation](https://github.com/syedanazish-debug/image-preparing-lab/blob/main/image_processor.py): `image_processor.py`

### Other components

- **Image user**

## Connections

- Image user → Upload and workflow: uploads image
- Upload and workflow → Megapixel calculation: calculates megapixels
- Upload and workflow → Crop validation: validates coordinates
- Upload and workflow → Image cropping: crops image
- Upload and workflow → Target resizing: resizes if needed
- Target resizing → Scale calculation: calculates scale
- Upload and workflow → JPEG export: encodes JPEG
- Upload and workflow → Image user: offers download
