Prompt
I'm trying to resize and compress blog images in bulk before upload
Latest observation
Nov 3, 2026
OpenAI APIWeb search: off
You can do this efficiently in bulk with a command-line tool or a small script. The best approach depends on your setup:
Option 1: ImageMagick (simple and flexible)
If you want to resize all images in a folder and compress them:
mkdir -p output
magick mogrify -path output -resize 1600x1600\> -strip -quality 82 *.jpg
For PNGs:
magick mogrify -path output -resize 1600x1600\> -strip *.png
What it does
-resize 1600x1600\>: resizes only if larger than 1600px, keeps aspect ratio-strip: removes metadata to reduce size-quality 82: JPEG compression quality
Option 2: Use a Python script for mixed formats
If you have JPG, PNG, WebP, etc., and want more control:
from PIL import Image
from pathlib import Path
input_dir = Path("images")
output_dir = Path("compressed")
output_dir.mkdir(exist_ok=True)
max_size = (1600, 1600)
for img_path in input_dir.glob("*"):
if img_path.suffix.lower() not in [".jpg", ".jpeg", ".png", ".webp"]:
continue
with Image.open(img_path) as img:
img.thumbnail(max_size)
out_path = output_dir / img_path.name
if img.mode in ("RGBA", "P") and out_path.suffix.lower() in [".jpg", ".jpeg"]:
img = img.convert("RGB")
if out_path.suffix.lower() in [".jpg", ".jpeg"]:
img.save(out_path, quality=82, optimize=True)
elif out_path.suffix.lower() == ".png":
img.save(out_path, optimize=True)
elif out_path.suffix.lower() == ".webp":
img.save(out_path, quality=82, method=6)
Install Pillow first:
pip install pillow
Option 3: If you want very small files
If file size is the main goal, consider:
- converting JPG/PNG to WebP
- using AVIF if your platform supports it
Example with ImageMagick:
magick input.jpg -resize 1600x1600\> -strip -quality 80 output.webp
Recommended blog settings
- Max width:
1200–1600px - JPEG quality:
75–85 - Strip metadata
- Use WebP if supported
If you want, I can give you:
- a one-liner for macOS/Linux,
- a Windows batch/PowerShell version, or
- a Python script that processes an entire folder recursively.