😫 The Pain Point
E-commerce platforms require square product images. Your catalog has mixed aspect ratios - some landscape, some portrait. Manually cropping each image to center the product takes forever.
🚀 Agentic Solution
A Smart Cropper that detects the best center point and crops or adds padding automatically.
Key Features:
- Smart Center: Detects product position and centers the crop.
- Padding Option: Adds white/transparent padding instead of cropping.
- Batch Processing: Handles entire folders with progress tracking.
⚔️ Phase 1: Commander (Quick Fix)
For quick cropping.
Prompt:
“I have a folder
productswith varied aspect ratio images. Write a Python script using Pillow to:
- Crop Mode: Center-crop each image to a perfect square (use shorter dimension).
- Alternative Padding Mode: Or add white padding to make square (preserving full image).
- Output: Save to
squared/folder as JPG (quality=90).- Error Handling: Skip corrupt files with warning.
Print progress log. Accept
--mode cropor--mode padargument.”
Result: Perfectly square images ready for upload.
🏗️ Phase 2: Architect (Permanent Tool)
For Content Teams.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Smart Square Cropper" Desktop App
**Objective:** A desktop application to batch crop or pad product images to perfect squares.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Image Processing: Pillow
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** Source Folder selection.
* **Controls:** Radio buttons for "Center Crop" vs "Add Padding" (White/Transparent).
* **Size:** Input field for Target Size (default 1000px).
* **Preview:** Before/After toggle view.
* *Constraint:* Clean, modern native UI.
2. **Core Logic:**
* **Crop Mode:** Calculate center offset and crop shortest dimension.
* **Pad Mode:** Create specific size canvas and paste image in center.
* **Threading:** Process whole folder in background thread with Progress Bar.
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
- Center Crop vs Padding: Two different use cases. Crop loses data but looks cleaner. Padding preserves everything but may look less polished.
🛠️ Instructions
- Copy Prompt → Paste → Run.
- Choose mode → Process folder.