|
| 1 | + |
1 | 2 | ```markdown |
2 | 3 | # 🧶 Knit App |
3 | 4 |
|
4 | 5 | ## About This Project |
5 | 6 | Knit App is a comprehensive Streamlit-based application designed for knitters and compatible with crocheters and other textile makers. It bridges the gap between digital pixel art and physical garment construction. Users can upload images to generate alpha patterns, calculate garment shaping (Front, Back, and Sleeves) based on gauge and sizing, and edit multiple graphics on a digital canvas. |
6 | 7 |
|
| 8 | +--- |
7 | 9 |
|
8 | 10 | ## Key Features |
9 | 11 | * **Pattern Digitization:** Upload any PNG/JPG and use dynamic thresholding and resampling to convert it into a pixel matrix that you can layer onto a sweater canvas. |
10 | 12 | * **Multi-Panel Garment IDE:** Switch between Front Panel, Back Panel, and Sleeves canvases that make up a drop shoulder sweater. The app dynamically calculates dimensions and short-row shaping based on user measurements and gauge. |
11 | 13 | * **Layer Design Studio:** Add, duplicate, merge, and transform (rotate, flip, mirror, scale) multiple graphics on a single canvas. |
12 | 14 | * **Fine-Tune Pixel Editor:** A built-in, manual spreadsheet-style editor to fine-tune individual stitches or draw custom motifs from scratch on blank 25x25 or 50x50 canvases. |
13 | | -* **Alpha JSON exporter:** Export your custom design to a JSON file to reuse in future projects. |
| 15 | +* **Alpha JSON Exporter:** Export your custom design to a JSON file to reuse in future projects. |
14 | 16 | * **Master PDF Compiler:** Automatically chunks your digital canvas into a printable PDF pattern complete with cast-on counts, row instructions, and sweater specs. |
15 | 17 | * **Project Saving:** Serialize your entire workspace (including layers, settings, and math grids) into a JSON file to resume your work later. |
16 | 18 |
|
| 19 | +--- |
17 | 20 |
|
18 | 21 | ## Prerequisites |
19 | 22 | Before installing, ensure you have **Python 3.9 or newer** installed on your system. We highly recommend using a virtual environment (like `venv` or Anaconda) to keep dependencies clean. |
20 | 23 |
|
| 24 | +--- |
21 | 25 |
|
22 | 26 | ## Installation |
23 | 27 |
|
24 | 28 | ### Option A: Using GitHub Desktop |
25 | 29 | 1. Download and install [GitHub Desktop](https://desktop.github.com/). |
26 | 30 | 2. Open GitHub Desktop and go to **File > Clone repository**. |
27 | | -3. Select the **URL** tab and paste: `https://github.com/Programming-The-Next-Step-2026/knitting_pattern.git` |
| 31 | +3. Select the **URL** tab and paste: |
| 32 | + ```text |
| 33 | + [https://github.com/Programming-The-Next-Step-2026/knitting_pattern.git](https://github.com/Programming-The-Next-Step-2026/knitting_pattern.git) |
| 34 | +
|
| 35 | +``` |
| 36 | + |
28 | 37 | 4. Choose a local path on your computer and click **Clone**. |
29 | 38 | 5. Open your preferred terminal (or Anaconda Prompt) and navigate to the folder you just cloned. |
30 | 39 | 6. Run the following command to install the package and its dependencies: |
31 | | - pip install -e . |
| 40 | +```bash |
| 41 | +pip install -e . |
| 42 | + |
| 43 | +``` |
| 44 | + |
32 | 45 |
|
33 | 46 |
|
34 | 47 | ### Option B: Command Line (Windows / Mac / Linux) |
35 | | -1. Open your Terminal/Command Prompt/PowerShell. |
| 48 | + |
| 49 | +1. Open your Terminal, Command Prompt, or PowerShell. |
36 | 50 | 2. Clone the repository: |
| 51 | +```bash |
37 | 52 | git clone [https://github.com/Programming-The-Next-Step-2026/knitting_pattern.git](https://github.com/Programming-The-Next-Step-2026/knitting_pattern.git) |
38 | 53 |
|
| 54 | +``` |
| 55 | + |
| 56 | + |
39 | 57 | 3. Navigate into the directory: |
| 58 | +```bash |
40 | 59 | cd knitting_pattern |
41 | 60 |
|
| 61 | +``` |
| 62 | + |
| 63 | + |
42 | 64 | 4. Install the package: |
| 65 | +```bash |
43 | 66 | pip install -e . |
44 | 67 |
|
| 68 | +``` |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +--- |
45 | 73 |
|
46 | 74 | ## Usage |
47 | | -Once installed, make sure your in the knitting_pattern directory, then run the application locally: |
| 75 | + |
| 76 | +Once installed, make sure you are in the `knitting_pattern` root directory, then launch the application locally: |
| 77 | + |
| 78 | +```bash |
48 | 79 | streamlit run src/knitting_pattern/app.py |
49 | 80 |
|
| 81 | +``` |
| 82 | + |
50 | 83 | This will automatically open the Knit App dashboard in your default web browser. |
51 | 84 |
|
| 85 | +--- |
| 86 | + |
52 | 87 | ## Project Architecture |
53 | 88 |
|
54 | | -* **`app.py`:** The Streamlit UI layer acting as the bridge for state management and user interaction. |
55 | | -* **`math_engine.py`:** Calculates physical measurements, gauge conversions, and garment topography (like short row geometry). |
56 | | -* **`image_engine.py`:** Handles digital formatting, utilizing Pillow and NumPy for image resampling, bounding box cropping, and Matplotlib for dynamic PDF generation. |
| 89 | +The software is cleanly modularized into separated layers of concern: |
| 90 | + |
| 91 | +* **`app.py`:** The Streamlit UI layer acting as the primary hub for state management, reactive canvas rendering, and user interaction. |
| 92 | +* **`math_engine.py`:** Governs physical measurements, gauge conversions, and garment topography calculations (including dynamic short-row geometry and sleeve tapers). |
| 93 | +* **`image_engine.py`:** Handles spatial canvas manipulation, utilizing Pillow and NumPy for image resampling, bounding box cropping, and Matplotlib for dynamic multi-page PDF generation. |
| 94 | + |
| 95 | +--- |
57 | 96 |
|
58 | 97 | ## License |
59 | 98 |
|
60 | | -Distributed under the MIT License. Built for the course *Programming: The Next Step (2026)*. |
| 99 | +Distributed under the MIT License. Built as a final capstone project for the university course *Programming: The Next Step (2026)*. |
| 100 | + |
| 101 | +``` |
| 102 | + |
| 103 | +``` |
0 commit comments