Compress JPG images with jpegoptim
Reduce the size of JPEG photos for web pages or email, in bulk or one at a time.
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 *.jpg02What 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
!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
- jpegoptim(1) — utility to optimize JPEG filesEvidence: jpegoptim --max=N recompresses JPEG files so they do not exceed the given quality target, in place or to a destination directory.
Last verified: 2026-09-18 · Category: Files & Folders