Upload an image in your browser, split it into tiles, and download tiles for Instagram posting.
- Upload image from browser
- Split mode: both (grid), vertical, or horizontal
- Split line preview and tile gallery
- Download all tiles as one ZIP
- Select specific tiles and download selected ZIP
- Optional separate file download links per tile
- Quality-preserving split flow (no upscale/resize interpolation)
- Tiles exported as PNG to minimize compression artifacts
Project is now organized so developers can extend features safely:
- app.py: minimal entrypoint
- ig_splitter/config.py: constants and app limits
- ig_splitter/models.py: request/result data models
- ig_splitter/services/image_service.py: splitting and grid logic
- ig_splitter/services/storage_service.py: file persistence and ZIP utilities
- ig_splitter/web/routes.py: Flask routes and request validation
- templates/index.html: UI and interaction flow
- static/style.css: styling and responsive behavior
Before running locally, install:
- Python 3.10 or newer (recommended: Python 3.11+)
- pip (comes with Python)
- A terminal (PowerShell on Windows is fine)
Optional but recommended:
- VS Code with Python extension
- Git (for cloning and version control)
Check versions:
python --version
pip --versionIf python is not recognized on Windows, try:
py --version- Go to the project folder:
cd c:\Users\henry\Desktop\selflearn\python\ig-splitter- Create virtual environment:
python -m venv .venv- Activate virtual environment:
.\.venv\Scripts\Activate.ps1If PowerShell blocks activation, run this once in PowerShell (CurrentUser scope):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser- Install dependencies:
pip install -r requirements.txt- Make sure virtual environment is activated.
- Start the app:
python app.py- Open browser:
- Use the app:
- Upload image
- Choose split mode and grid values
- Process image
- Download all tiles as ZIP or download needed tiles
You can run this project fully from terminal/prompt mode:
python -m ig_splitter.cli --input "C:/path/image.jpg" --rows 3 --cols 3 --split-mode both --download-mode zipExamples:
python -m ig_splitter.cli --input "C:/path/image.jpg" --split-mode vertical --cols 4 --download-mode zip
python -m ig_splitter.cli --input "C:/path/image.jpg" --split-mode horizontal --rows 5 --download-mode nozipOutputs are generated in runs/<run_id>/.
Non-web execution skill for agent workflows is available at:
.github/skills/ig-splitter-non-web/SKILL.md
After activating .venv, run:
python -m pytest -qTest coverage includes unit tests for service/helper functions and integration/regression tests for upload, split modes, and download flows.
- Always run inside virtual environment (
.venv) so dependency versions stay stable. - Use
python -m pip install ...ifpipcommand points to wrong Python. - Keep dependencies in
requirements.txtupdated when adding packages. - Avoid running with global Python packages for project work.
- Use clear terminal output and stop the server with
Ctrl + C. - Keep route handlers thin; put business logic in
ig_splitter/services. - Add constants to
ig_splitter/config.pyinstead of hardcoding values. - Prefer typed dataclasses in
ig_splitter/models.pyfor data passed to templates.
Recommended commands:
python -m pip install -r requirements.txt
python app.py- Port already in use:
- Stop other process using port 5000 or run with another port by editing app startup.
- Module not found:
- Activate
.venv, then reinstall requirements.
- Activate
- Pillow install problems:
- Upgrade pip first:
python -m pip install --upgrade pip
- Upgrade pip first:
- Browser not opening:
- Copy and paste URL manually into browser.
- Supported image formats: PNG, JPG, JPEG, WEBP
- Split tiles are exported as PNG for better quality retention
- Upload size is not limited by app config
- ZIP downloads store files without deflate compression
- Generated output is saved in
runs/