Image Compression Guide โ€” From Zero to Automation

Whether you're occasionally compressing a passport photo or handling dozens of images every day for your website, this guide will double your efficiency. From the simplest methods to command-line automation, pick what fits your needs.

Getting Started: Online Compression โ€” Done in 3 Seconds

How to Use TinyPNG

1. Go to tinypng.com
2. Drag your images (PNG/JPEG/WebP) into the dashed box on the page
3. Wait a few seconds and see the compression result (e.g., "Saved 78%!")
4. Click "Download" to save the compressed images

Up to 20 images at a time, each under 5MB. If you have more, split them into batches. TinyPNG also has a Pro plan at $25/year that removes limits and provides an API โ€” but unless you're compressing hundreds of images daily, the free version is plenty.

How to Use Squoosh

1. Open squoosh.app
2. Click the + button or drag in an image
3. Choose a compression method from the bottom-left (MozJPEG/OxiPNG/WebP/AVIF, etc.)
4. Drag the Quality slider and preview the result in real time on the right
5. When satisfied, click the download button in the bottom-right corner

A hidden Squoosh trick: you can stack multiple compression steps. For example, first convert PNG to WebP, then adjust WebP quality parameters, and finally resize. Layer by layer, the result is much better than using a single tool.

Intermediate: Batch Processing โ€” Stop Uploading One by One

Caesium (Windows/Mac/Linux)

1. Download and install from saerasoft.com/caesium
2. Open it and click "Add images" or drag an entire folder in
3. Set compression parameters on the right: quality %, whether to keep metadata, output format
4. Click "Compress!" and let it run

Recommended settings: JPEG quality 75-85%, use lossy compression mode for PNG. Strip all metadata (EXIF/GPS info) โ€” it can save an extra 5-10% and protects your privacy, since photos taken with your phone may have GPS coordinates embedded.

ImageOptim (Mac Only)

A Mac-exclusive gem. Drag images or folders in and it processes them automatically. It uses lossless compression, so quality is unchanged โ€” it reduces file size by:

Lossless compression rates are typically 20-40% โ€” not as much as lossy, but 100% quality retention. Ideal for archiving source files.

ใ€Ad Spaceใ€‘

Advanced: Command-Line Automation

If you build websites or apps, image compression should be part of your build pipeline. Here are some excellent command-line tools:

pngquant โ€” Lossy PNG Compression

# Install
brew install pngquant  # Mac
# Usage: single file
pngquant --quality=65-80 image.png --output image-compressed.png
# Batch: all PNGs in a folder
find . -name "*.png" -exec pngquant --quality=65-80 --ext .png --force {} \;

jpegoptim โ€” JPEG Optimization

brew install jpegoptim
# Compress to 80% quality
jpegoptim --max=80 image.jpg
# Batch + strip metadata
jpegoptim --max=80 --strip-all *.jpg

One-Click Compression Script (save as compress.sh)

#!/bin/bash
# Compress all images in the current folder
echo "Compressing PNGs..."
find . -name "*.png" -exec pngquant --quality=65-80 --ext .png --force {} \;
echo "Compressing JPEGs..."
find . -name "*.jpg" -o -name "*.jpeg" | while read f; do
  jpegoptim --max=80 --strip-all "$f"
done
echo "All done!"

Place this script in your images folder, chmod +x compress.sh then ./compress.sh โ€” all images compressed automatically. For websites, integrate it into your CI/CD pipeline so compression happens on every deploy.

Website Image Optimization Best Practices