😫 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 Tool Developer
**Task:** Create a "Smart Square Cropper".
**Requirements:**
1. **GUI:**
* Select folder.
* Mode: Crop (center) vs Pad (white/transparent).
* Target size (default 1000x1000).
* Preview before/after.
* Progress bar.
2. **Logic:**
* Calculate crop box from center.
* Handle RGBA for transparent padding.
* Skip corrupt files gracefully.
3. **Deliverables:**
* `auto_crop.py`
* `run.bat`, `run.sh`
* `requirements.txt`
🧠 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.