π« The Pain Point
You have 500 photos from a DSLR camera (20MB each, 6000px resolution). You need to upload them to a website that only accepts photos under 2000px. Opening Photoshop -> Image Size⦠500 times is impossible.
π Agentic Solution
A Batch Resizer: βMake everything 1920px wideβ in one click.
Key Features:
- Aspect Ratio Lock: Resizes width to 1920px and automatically calculates height to prevent squashed images.
- Format Conversion: Can simultaneously convert PNG to JPG to save space.
βοΈ Phase 1: Commander (Quick Fix)
For a quick resize job.
Prompt:
βResize all images in the current folder to a maximum width of 1920px. Keep the aspect ratio. Save them to a new folder named βResizedβ to avoid checking original files.β
Result: A folder of web-ready images.
ποΈ Phase 2: Architect (Permanent Tool)
For Photographers/Web Admins.
Engineering Prompt:
**Role:** Python Tool Developer
**Task:** Create a "Universal Image Resizer".
**Requirements:**
1. **GUI:**
* Select Source Folder.
* Input: Max Width (e.g., 1920) OR Max Height.
* Quality Slider (1-100).
* "Process" button.
2. **Logic:**
* Use `Pillow` (PIL).
* `img.thumbnail((width, height))` is the safest method to maintain aspect ratio.
* Show a progress bar.
3. **Deliverables:** `batch_resize.py`, `run.bat` (Windows), `run.sh` (Mac).
π§ Prompt Decoding
- Thumbnail Method: The
thumbnail()function in Pillow is smarter thanresize(). It automatically calculates the correct dimensions to fit within your box without distorting the image.
π οΈ Instructions
- Copy Prompt -> Paste -> Run.
- Input 1920 -> Process.