π« The Pain Point
You want to create a 3x3 photo grid for Instagram or a product collage for marketing. Opening Canva, uploading 9 images, aligning them manually⦠takes 15 minutes per grid.
π Agentic Solution
An Automatic Grid Generator that arranges images into customizable layouts.
Key Features:
- Flexible Grids: 2x2, 3x3, 4x4, or custom rows/columns.
- Padding Control: Adjustable gaps between images.
- Smart Fit: Images are cropped or padded to fill cells evenly.
βοΈ Phase 1: Commander (Quick Fix)
For a quick collage.
Prompt:
βI have 9 images in a folder
photos. Write a Python script using Pillow to:
- Grid Layout: Create a 3x3 grid (1080x1080 final size).
- Cell Size: Each cell is 360x360px.
- Padding: 10px white gap between cells.
- Fit Mode: Center-crop images to fill cells.
- Output: Save as
grid_output.jpg(quality=90).Handle cases with fewer than 9 images (fill remaining with white).β
Result: A perfect Instagram-ready collage.
ποΈ Phase 2: Architect (Permanent Tool)
For Social Media Managers.
Engineering Prompt:
**Role:** Python Tool Developer
**Task:** Create a "Photo Grid Generator".
**Requirements:**
1. **GUI:**
* Select image folder or drag/drop images.
* Grid size inputs (rows, columns).
* Cell size / final output size.
* Padding (pixels) and background color.
* Fit mode: Crop / Pad / Stretch.
* Preview before save.
2. **Logic:**
* Sort images alphabetically or by date.
* Calculate cell dimensions.
* Handle transparent backgrounds.
3. **Deliverables:**
* `grid_maker.py`
* `run.bat`, `run.sh`
* `requirements.txt`
π§ Prompt Decoding
- Cell Size Math: A 3x3 grid with 10px padding:
(1080 - 20) / 3 = ~353px per cell. The AI handles this calculation.
π οΈ Instructions
- Copy Prompt β Paste β Run.
- Adjust grid size as needed.