Using jpegoptim to optimize JPEG images

nonunicorn

Onelinerhub

Posted on August 4, 2022

Using jpegoptim to optimize JPEG images

1. Batch optimize multiple JPG images

jpegoptim --strip-all /dir/*.jpg
Enter fullscreen mode Exit fullscreen mode
  • jpegoptim - tool to optimize JPG images (apt install jpegoptim),
  • --strip-all - removes all meta data from file,
  • /dir/*.jpg - list of images to optimize (files will be overwritten).

Open original or edit on Github.

2. Optimize JPG image

jpegoptim --strip-all img.jpg
Enter fullscreen mode Exit fullscreen mode
  • jpegoptim - tool to optimize JPG images (apt install jpegoptim),
  • --strip-all - removes all meta data from file,
  • img.jpg - input image to be optimized (will be overwritten).

Open original or edit on Github.

3. Optimize JPG image to fit to certain file size

jpegoptim --strip-all -S 100k img.jpg
Enter fullscreen mode Exit fullscreen mode
  • jpegoptim - tool to optimize JPG images (apt install jpegoptim),
  • --strip-all - removes all meta data from file,
  • -S 100k - try to optimize so that final file size is less than 100k,
  • img.jpg - input image to be optimized (will be overwritten).

Open original or edit on Github.

💖 💪 🙅 🚩
nonunicorn
Onelinerhub

Posted on August 4, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related