π« 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 GUI Developer (PyQt6 Specialist)
**Task:** Create "Photo Grid Studio" Desktop App
**Objective:** A design tool to auto-arrange images into Instagram-ready grids and collages.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Image Processing: Pillow
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Sources:** List of added images (drag-and-drop reordering).
* **Grid Config:** Inputs for Rows, Columns, Padding (px), Background Color picker.
* **Canvas:** Live preview of the grid layout.
* **Fit Mode:** Radio buttons for "Crop to Fill" vs "Fit Inside".
2. **Core Logic:**
* Calculate cell dimensions based on total size + padding.
* Resize/Crop images to fit cells.
* Result generation and export.
* **Threading:** Not strictly critical but good for high-res exports.
3. **Deliverables:**
* `main.py`: Complete source code.
* `requirements.txt`: Dependencies.
* **Build Instructions:**
* Windows: `pyinstaller --onefile --noconsole main.py`
* macOS: `pyinstaller --windowed --noconsole main.py`
π§ 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.