DEV Community

Bobo
Bobo

Posted on

image-optimizer: Batch Compress and Resize Images from CLI

image-optimizer: Batch Compress and Resize Images from CLI

Web performance matters. Large images slow down your site, hurt SEO, and frustrate users. image-optimizer gives you a dead-simple CLI to optimize all your images in one command.

Installation

npm install -g batch-image-tool
Enter fullscreen mode Exit fullscreen mode

Features

Compress Images

batch-image-tool compress ./images/ -o ./optimized/
# Shrinks file size by 60-80% without visible quality loss
Enter fullscreen mode Exit fullscreen mode

Resize

batch-image-tool resize ./images/ --width 1200 -o ./web/
Enter fullscreen mode Exit fullscreen mode

Convert Format

batch-image-tool convert ./images/ --format webp -o ./web/
Enter fullscreen mode Exit fullscreen mode

Batch Process

batch-image-tool process ./raw/ --compress --resize 1920 --format jpg
Enter fullscreen mode Exit fullscreen mode

Supported Formats

  • JPEG / JPG ✅
  • PNG ✅
  • WebP ✅
  • BMP ✅
  • TIFF ✅

Real-World Use

# Optimize an entire photo gallery
batch-image-tool process ./photos/ --resize 1920 --quality 80 -o ./web/

# Create thumbnails
batch-image-tool resize ./photos/ --width 300 -o ./thumbs/
Enter fullscreen mode Exit fullscreen mode

Links

💻 GitHub: github.com/lb1192176991-lab/batch-image-tool

🌐 Visit us: https://www.tucaowall.vip/


Need more file processing tools? Check out the sibling packages for CSV, JSON, PDF, and text processing!

☁️ Get free DigitalOcean credit: https://m.do.co/c/fc5cb7b29a0d

Top comments (0)