Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

187 lines (163 sloc) 6.436 kb
.TH JPEGOPTIM 1 "28 Nov 2014"
.UC 4
jpegoptim \- utility to optimize/compress JPEG/JFIF files.
.B jpegoptim
.B options
] [
.B filenames
.I jpegoptim
is used to optimize/compress jpeg files. Program supports lossless
optimization, which is based on optimizing the Huffman tables. And
so called "lossy" optimization where in addition to optimizing Huffman
tables user can specify upperlimit for image quality.
NOTE! By default jpegoptim modifies the input files (if they are optimized),
to preserve original files use option \fB\-d\fR to specify alternate directory for saving the optimized files to.
Only normal files are optimized (symbolic links and special files are skipped).
Also, any other hard links to the file being optimized (as created using
.BR link (2))
are unaffected.
Options may be either the traditional POSIX one letter options, or the
GNU style long options. POSIX style options start with a single
``\-'', while GNU long options start with ``\-\^\-''.
Options offered by
.I jpegoptim
are the following:
.TP 0.6i
.B -d<path>, --dest=<path>
Sets alternative destination directory where to save optimized files
(default is to overwrite the originals). Please note that unchanged files
won't be added to the destination directory. This means if the source
file can't be compressed, no file will be created in the destination path.
.TP 0.6i
.B -f, --force
Force optimization, even if the result would be larger than the original
.TP 0.6i
.B -h, --help
Displays short usage information and exits.
.TP 0.6i
.B -m<quality>, --max=<quality>
Sets the maximum image quality factor (disables lossless optimization
mode, which is by default enabled). This option will reduce quality
of those source files that were saved using higher quality setting.
While files
that already have lower quality setting will be compressed using the
lossless optimization method.
Valid values for quality parameter are: 0 - 100
.TP 0.6i
.B -n, --noaction
Don't really optimize files, just print results.
.TP 0.6i
.B -S<size>, --size=<size>
Try to optimize file to given size (disables lossless
optimization mode). Target size is specified either in
kilobytes (1 - n) or as percentage (1% - 99%) of the original file size.
.TP 0.6i
.B -T<threshold>, --threshold=<threshold>
Keep the file unchanged if the compression gain is lower than the threshold (%).
Valid values for threshold are: 0 - 100
.TP 0.6i
.B -b, --csv
Print progress info in CSV format.
.TP 0.6i
.B -o, --overwrite
Overwrite target file even if it exists (when using -d option).
.TP 0.6i
.B -p, --preserve
Preserve file modification times.
.TP 0.6i
.B -P, --preserve-perms
Preserve file permissions (owner/group) by overwriting the original file. This is
slightly less safe than the default mode of operation (where new file is first saved
as temporary file and then renamed over the original file).
In this mode a backup of the original file is made with .jpegoptim.bak extension,
and this file is removed after the original file has been successfully replaced.
NOTE! if running jpegoptim as root there is generally no need to use this option,
as jpegoptim is able to preserve file permissions when run by root in default mode.
.TP 0.6i
.B -q, --quiet
Quiet mode.
.TP 0.6i
.B -t, --totals
Print totals after processing all files.
.TP 0.6i
.B -v, --verbose
Enables verbose mode (positively chatty).
.TP 0.6i
.B --all-normal
Force all output files to be non-progressive. Can be used to convert
all input files to progressive JPEGs when used with --force option.
.TP 0.6i
.B --all-progressive
Force all output files to be progressive. Can be used to convert
all input files to normal (non-progressive) JPEGs when used with --force option.
.TP 0.6i
.B -s, --strip-all
Strip all markers from output file. (NOTE! by default
only Comment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything else is discarded).
Output JPEG still likely will contains one or two markers (JFIF and Adobe APP14) depending
on colorspace used in the image, as these markers are generated by the libjpeg encoder
.TP 0.6i
.B --strip-none
Preserve "all" markers in the image. This will leave all markers untouched in the image,
except JFIF (APP0) and Adobe (APP14) markers as those get regenerated by the libjpeg library.
.TP 0.6i
.B --strip-com
Strip Comment (COM) markers from output file.
.TP 0.6i
.B --strip-exif
Strip EXIF markers from output file.
.TP 0.6i
.B --strip-iptc
Strip IPTC / Adobe Photoshop (APP13) markers from output file.
.TP 0.6i
.B --strip-icc
Strip ICC profiles from output file.
.TP 0.6i
.B --strip-xmp
Strip XMP profiles from output file.
.TP 0.6i
.B --stdout
Send output image to standard output. Note, if optimization didn't create smaller file
than the input file, then no output (image) is sent to standard output. (Option
.B -f
can be used to force output of image always, even if optimized image was not smaller than input).
.TP 0.6i
.B --stdin
Read input image from standard input. When this option is used then only one
image is read from standard output. Any (other) input files specified on command
line are ignored.
Note, if input file '-' is seen on command line then standard input is also assumed.
Currently this option will explicitly enable
.B -f
option, thus output image is always sent to standard output (even if no optimization was possible).
When using --size option, resulting file is not always exactly the
requested size. Workaround is to re-run jpegoptim on the same file again
which often will result file closer to target size.
Timo Kokkonen <>
Copyright (C) 1996-2014 Timo Kokkonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jump to Line
Something went wrong with that request. Please try again.