jpegoptim
Optimize JPEG files for smaller size
TLDR
Optimise a set of JPEG images, retaining all associated data
Optimise JPEG images, stripping all non-essential data
Force the output images to be progressive
Force the output images to have a fixed maximum filesize
SYNOPSIS
jpegoptim [options] files...
PARAMETERS
-d
Specify destination directory for optimized files. The original files are not modified.
-f
Force optimization even if the file seems corrupt.
-h
Display help message and exit.
-m
Set maximum image quality factor (0-100). Lower values result in smaller files but potentially lower image quality.
-n
Do not actually perform the optimization, just print what would happen.
-o
Optimize the JPEG file more (can take longer).
--overwrite
Allow overwriting of input files.
-p
Preserve file timestamps.
-q
Quiet mode. Suppress all output except for errors.
-s
Strip all metadata (EXIF, ICC profiles, comments).
--size=
Try to optimize file to specified size in bytes.
-S
Try to optimize file to specified size in kilobytes.
-t
Test mode. Check for errors but do not modify the file.
-v
Verbose mode. Show more detailed information.
-V
Display version information and exit.
--all-progressive
Convert all JPEG files to progressive.
--strip-none
Do not strip anything
--strip-all
Strip all (same as -s option)
--strip-exif
Strip exif metadata
--strip-iptc
Strip iptc metadata
--strip-com
Strip comment metadata
--strip-icc
Strip icc metadata
--threshold=
Conditional strip options threshold (0-100)
If the new quality would be less than the specified threshold, the stripping option is ignored.
DESCRIPTION
jpegoptim is a command-line tool for optimizing and compressing JPEG files without any loss of quality (lossless optimization) or with a specified level of lossy compression to reduce file size further. It can be used to reduce the size of JPEG files, making them faster to load on websites and saving disk space. jpegoptim offers various options for specifying the desired optimization level, including stripping metadata (EXIF, ICC profiles, comments), setting a maximum quality factor, and preserving timestamps. The tool uses a combination of techniques, including Huffman table optimization and progressive encoding, to achieve significant size reductions while maintaining visual quality. It's a valuable tool for web developers, photographers, and anyone who needs to manage and optimize JPEG images efficiently. It is focused on performing operations in place (i.e, overwriting the input files).
CAVEATS
jpegoptim overwrites the original files by default. Be sure to have backups before running it, especially when using lossy compression.
EXIT STATUS
jpegoptim returns 0 on success, and non-zero on error.
HISTORY
jpegoptim was created to provide a simple and effective way to optimize JPEG files from the command line. It has been actively developed and maintained over the years, adding new features and improving optimization techniques to keep pace with evolving JPEG standards and usage patterns.