Compress JPG images with jpegoptim

Reduce the size of JPEG photos for web pages or email, in bulk or one at a time.

LinuxcompressionimageMedium risk
Run jpegoptim --max=85 photo.jpg to recompress it in place, or jpegoptim --max=85 *.jpg for a whole folder.

01Command

Command
$ jpegoptim --max=85 photo.jpg && jpegoptim --max=85 *.jpg

02What it does

jpegoptim re-encodes JPEGs so they stay under the quality level you set — --max=85 usually cuts 30–60% of file size with no visible change. It overwrites the original file unless you keep copies with --dest=dir or run in strip mode to drop metadata: --strip-all removes EXIF and comments for extra savings.

03Risk

RiskMedium risk
Requirementsjpegoptim package (apt install jpegoptim / dnf install jpegoptim)
!Warning: jpegoptim overwrites your originals. Back up photos first, or use --dest=./small to write the compressed versions to another folder instead of replacing the source files.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-18 · Category: Files & Folders