DEV Community

IAMUU
IAMUU

Posted on

Batch Processing Images Without Writing a Script — Resize, Compress, Rename 500 Files in 30 Seconds

I recently had to prepare 500 product photos for a client's e-commerce migration. Each needed to be: resized to 1200px wide,compressed under 200KB, and renamed to SKU-001.jpg format.

Here's what I learned about doing this efficiently:

The manual way (please don't):
Open each photo → ⌘+Option+I → type width → Export As → set quality → save. That's 1,500 clicks for 500 images.

The scripting way:
for f in *.jpg; do
convert "$f" -resize 1200 -quality 80 "processed/$f"
done
Works great. ImageMagick dependency, need to handle edge cases.

The pipeline approach:

  1. Resize everything in one batch
  2. Compress in one batch
  3. Rename with a pattern

Three operations, one command each. No custom script needed.

I built a small CLI tool for this called imgbatch (pip install imgbatch):
imgbatch resize photos/.jpg --width 1200
imgbatch compress photos/
.jpg --quality 80
imgbatch rename photos/*.jpg --pattern "SKU-{n:03d}{ext}"

For PDFs and more advanced operations (merge, split, OCR, watermark), I use U-Ultra/Unity as a zero-install alternative. The free tier handles files up to 50MB with no registration.

The key lesson: batch processing is about doing the same transform to many files at once. Whether you use a CLI, a script, or a web tool, the pattern is always: select → transform → output. Don't do repetitive work manually.

Top comments (0)