Skip to content

torturado/instagrid2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

instagrid2025 – Instagram grid slicer and preview (3:4)

CI

Python tool to slice an image into 1080×1350 tiles and generate previews with grid guides and profile safe area (1013×1350). Includes a protect-profile mode to add lateral padding so nothing is cut in the Instagram profile view.

Features

  • Slice to 1080×1350 tiles (JPEG, upload ready)
  • Publication order from bottom-right to top-left
  • Preview with safe area (green) and profile-cropped margins (red)
  • Profile-preview simulator (1013×1350 per tile)
  • Protect-profile slicing (pads laterally so profile preserves the whole image)

Installation

  • Python 3.12+
  • Dependencies: Pillow, click, pytest, ruff, mypy
pip install -r requirements.txt

Quick usage (CLI)

# Slice (crop-center) into tiles
python -m instagrid2025.cli slice input.jpg --cols 3 --rows 3 --fit crop-center --out ./out

# Preview with guides and safe area
python -m instagrid2025.cli preview input.jpg --cols 3 --rows 3 --out ./out

# Profile preview (simulates profile view at 1013×1350 per tile)
python -m instagrid2025.cli profile-preview input.jpg --cols 3 --rows 3 --out ./out

# Protect-profile slicing (adds lateral padding so profile view loses nothing)
python -m instagrid2025.cli slice input.jpg --cols 3 --rows 3 --fit crop-center --protect-profile --out ./out

# Preview and profile-preview consistent with protect-profile
python -m instagrid2025.cli preview input.jpg --cols 3 --rows 3 --fit crop-center --protect-profile --out ./out
python -m instagrid2025.cli profile-preview input.jpg --cols 3 --rows 3 --fit crop-center --protect-profile --out ./out

CLI parameters

Option Description
--cols, --rows Grid size
--tile-width, --tile-height Tile size (default 1080×1350)
--safe-width Profile-visible width (default 1013)
--fit crop-center or letterbox
--bg Background color for letterbox/padding (hex)
--protect-profile/--no-protect-profile Wrap tiles with lateral padding so profile view shows full image
--out Output directory

Publication order

Bottom-right → top-left:

for r in reversed(range(rows)):
    for c in reversed(range(cols)):
        yield (r, c)

Library usage

from instagrid2025 import slice_image, generate_preview, generate_profile_preview

slice_image("input.jpg", "./out", cols=3, rows=3, fit="crop-center")
generate_preview("input.jpg", "./out", cols=3, rows=3)
generate_profile_preview("input.jpg", "./out", cols=3, rows=3)

Development

Run tests and QA:

pytest -q
ruff check .
python -m mypy instagrid2025

License

MIT License. See LICENSE.

Try locally

git clone https://github.com/torturado/instagrid2025.git
cd instagrid2025
python -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/pytest -q

About

Instagram grid slicer and preview (3:4)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages