DEV Community

Cover image for Using jpegoptim to optimize JPEG images
Onelinerhub
Onelinerhub

Posted on

4 1

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.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more