A single-file Pillow front-end for everyday image work — format conversion, resizing, cropping, colour adjustment, effects, watermarks, EXIF hygiene and platform presets.
Usable as a CLI or imported as a function.
python image_convert.py input.png -f webp # PNG -> WebP python image_convert.py input.heic -f jpg # HEIC -> JPEG python image_convert.py input.jpg --cover 1080x1080 # fill & centre-crop python image_convert.py input.jpg --strip-gps # drop location metadata python image_convert.py input.jpg --preset og # 1200x630 Open Graph
from image_convert import convert result = convert("input.jpg", fmt="webp", resolution="1080")
| Area | Options |
|---|---|
| Convert | jpg · png · webp · avif · heic-in, plus --pdf |
| Resize | exact, width-only, height-only, 50%, --fit (no upscale), --cover (fill + crop) |
| Crop | w:h:x:y, aspect ratios (1:1, 16:9), --autocrop whitespace trim |
| Orient | rotate, hflip, vflip, --fix-orientation (EXIF) |
| Colour | brightness, contrast, saturation, sharpness, gamma, auto-contrast, equalize, grayscale, sepia, invert, posterize |
| Effects | blur, sharpen, emboss, edges, pixelate, vignette, rounded corners, border |
| Overlay | image watermark (position + opacity), positioned text |
| Metadata | --strip-exif, --strip-gps, --dpi for print, --info |
| Quality | -q, --target-size 500 (fit N KB), --progressive, --optimize |
| Presets | instagram-post/story · twitter · youtube-thumb · og · favicon (multi-size .ico) · whatsapp |
| Advanced | --collage, --extract-frames (GIF), batch a whole folder |
--strip-gps exists because sharing camera-original JPEGs leaks where they were taken;
--target-size binary-searches quality to hit a byte budget instead of guessing.
pip install pillow
# optional: pillow-heif for HEIC input, pillow-avif-plugin for AVIF output--s3 is optional: it imports a local upload_to_url.py if one is present and skips the
upload with a warning if not.