๐ซ 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.