π« The Pain Point
You have 200 PNG screenshots but need JPG for email (smaller file size). Or you need WEBP for web performance. Converting one by one in an image editor is tedious.
π Agentic Solution
A Universal Format Converter that transforms images between any common formats.
Key Features:
- Multi-Format: Supports PNG, JPG, WEBP, GIF, BMP, TIFF.
- Quality Control: Adjustable compression for lossy formats.
- Alpha Handling: Properly handles transparency when converting to JPG.
βοΈ Phase 1: Commander (Quick Fix)
For quick conversion.
Prompt:
βI have a folder
imageswith PNG files. Write a Python script using Pillow to:
- Convert: All PNG to WEBP format.
- Quality: WEBP quality = 85.
- Transparency: If PNG has alpha, add white background before JPG conversion.
- Output: Save to
converted/folder.Print progress. Skip corrupt files with warning.β
Result: Optimized images for any use case.
ποΈ Phase 2: Architect (Permanent Tool)
For Web Developers.
Engineering Prompt:
**Role:** Python Tool Developer
**Task:** Create a "Universal Image Converter".
**Requirements:**
1. **GUI:**
* Select input folder.
* Target format dropdown (JPG, PNG, WEBP, GIF).
* Quality slider (for lossy formats).
* Background color for transparent images.
* Progress bar.
2. **Logic:**
* Detect input format automatically.
* Handle RGBA to RGB conversion.
* Preserve original filenames.
3. **Deliverables:**
* `format_converter.py`
* `run.bat`, `run.sh`
* `requirements.txt`
π§ Prompt Decoding
- Alpha Channel: PNG supports transparency, JPG doesnβt. The script must add a background color when converting.
π οΈ Instructions
- Copy Prompt β Run.
- Select target format β Convert.