1JPEGOPTIM(1) General Commands Manual JPEGOPTIM(1)
2
3
4
6 jpegoptim - utility to optimize/compress JPEG/JFIF files.
7
8
9
11 jpegoptim [ options ] [ filenames ]
12
13
15 jpegoptim is used to optimize/compress jpeg files. Program supports
16 lossless optimization, which is based on optimizing the Huffman tables.
17 And so called "lossy" optimization where in addition to optimizing
18 Huffman tables user can specify upperlimit for image quality.
19
20 NOTE! By default jpegoptim modifies the input files (if they are opti‐
21 mized), to preserve original files use option -d to specify alternate
22 directory for saving the optimized files to.
23
24 Only normal files are optimized (symbolic links and special files are
25 skipped). Also, any other hard links to the file being optimized (as
26 created using link(2)) are unaffected.
27
28
29
31 Options may be either the traditional POSIX one letter options, or the
32 GNU style long options. POSIX style options start with a single ``-'',
33 while GNU long options start with ``--''.
34
35 Options offered by jpegoptim are the following:
36
37 -d<path>, --dest=<path>
38 Sets alternative destination directory where to save optimized
39 files (default is to overwrite the originals). Please note that
40 unchanged files won't be added to the destination directory. This
41 means if the source file can't be compressed, no file will be
42 created in the destination path.
43
44 -f, --force
45 Force optimization, even if the result would be larger than the
46 original file.
47
48 -h, --help
49 Displays short usage information and exits.
50
51 -m<quality>, --max=<quality>
52 Sets the maximum image quality factor (disables lossless opti‐
53 mization mode, which is by default enabled). This option will re‐
54 duce quality of those source files that were saved using higher
55 quality setting. While files that already have lower quality
56 setting will be compressed using the lossless optimization
57 method.
58
59 Valid values for quality parameter are: 0 - 100
60
61 -n, --noaction
62 Don't really optimize files, just print results.
63
64 -S<size>, --size=<size>
65 Try to optimize file to given size (disables lossless optimiza‐
66 tion mode). Target size is specified either in kilobytes (1 - n)
67 or as percentage (1% - 99%) of the original file size.
68
69 -T<threshold>, --threshold=<threshold>
70 Keep the file unchanged if the compression gain is lower than the
71 threshold (%).
72
73 Valid values for threshold are: 0 - 100
74
75 -w<max>, --workers=<max>
76 Set the maximum number of parallel processes to launch. (Default
77 is 1)
78
79
80 -b, --csv
81 Print progress info in CSV format.
82
83 -o, --overwrite
84 Overwrite target file even if it exists (when using -d option).
85
86 -p, --preserve
87 Preserve file modification times.
88
89 -P, --preserve-perms
90 Preserve file permissions (owner/group) by overwriting the origi‐
91 nal file. This is slightly less safe than the default mode of op‐
92 eration (where new file is first saved as temporary file and then
93 renamed over the original file). In this mode a backup of the
94 original file is made with .jpegoptim.bak extension, and this
95 file is removed after the original file has been successfully re‐
96 placed. NOTE! if running jpegoptim as root there is generally no
97 need to use this option, as jpegoptim is able to preserve file
98 permissions when run by root in default mode.
99
100 -q, --quiet
101 Quiet mode.
102
103 -t, --totals
104 Print totals after processing all files.
105
106 -v, --verbose
107 Enables verbose mode (positively chatty).
108
109
110 --all-normal
111 Force all output files to be non-progressive. Can be used to con‐
112 vert all input files to non-progressive JPEGs when used with
113 --force option.
114
115 --all-progressive
116 Force all output files to be progressive. Can be used to convert
117 all normal (non-progressive) JPEGs input files to progressive
118 when used with --force option.
119
120
121 --all-arith
122 Force all output files to use Arithmetic Coding. This option is
123 experimental and only available if jpegoptim was compiled with
124 Arithmetic Coding support enabled.
125
126 --all-huffman
127 Force all output files to use (traditional) Huffman coding. This
128 option is experimental and only available if jpegoptim was com‐
129 piled with Arithmetic Coding support enabled.
130
131
132 --nofix
133 Skip processing of any input files that have any errors/warnings
134 during decompression. By default jpegoptim will attempt to opti‐
135 mize any file that it is able to decompress, even if decompres‐
136 sion generates warnings. This will 'fix' some (corrupt) JPEG im‐
137 ages automatically. If this behaviour is not desired, this op‐
138 tion can be used to make jpegoptim to skip any input files that
139 contain any errors.
140
141
142
143 --stdout
144 Send output image to standard output. Note, if optimization
145 didn't create smaller file than the input file, then no output
146 original image is passed through unmodified (except any extra
147 data after JPEG image will be discarded).
148
149
150 --stdin
151 Read input image from standard input and send output to standard
152 output (--stdout is assumend when this option is used). When
153 this option is used then only one image is read from standard in‐
154 put. Any (other) input files specified on command-line are ig‐
155 nored. Note, if input file '-' is seen on command line then
156 standard input is also assumed.
157
158
160 By default jpetoptim will keep common metadata (JPEG markers) and dis‐
161 card any other (unkown ones).
162
163 Following markers are kept by default:
164 - EXIF
165 - IPTC
166 - ICC
167 - XMP
168 - COM (JPEG Comment markers)
169
170 JFIF marker will be regenerated (by libjpeg) during the process (this
171 cannot be changed). However, Adobe marker is also generated (or omit‐
172 ted) by libjpeg based on the image colorspace, etc. This behavior de‐
173 pends on libjpeg library version being used. To make sure Adobe marker
174 is preserved option --keep-adobe can be used.
175
176 To remove additonal markers one or more the --strip-* options can be
177 used.
178
179 For example: --strip-icc --strip-xmp --strip-com
180
181
182 Alternatively it is possible to specify --strip-all and then one or
183 more of the --keep-* options to explicitly list which markers to keep
184
185 For example: --strip-all --keep-exif --keep-iptc
186
187
188 Options for controlling metadata (markers) in output files:
189
190
191 -s, --strip-all
192 Strip all markers from output file. (NOTE! by default only Com‐
193 ment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything
194 else is discarded). Output JPEG still likely will contains one
195 or two markers (JFIF and Adobe APP14) depending on colorspace
196 used in the image, as these markers are generated by the libjpeg
197 encoder automatically.
198
199 --strip-none
200 Preserve "all" markers in the image. This will leave all markers
201 untouched in the image, except JFIF (APP0) and Adobe (APP14)
202 markers as those get regenerated by the libjpeg library.
203
204 NOTE! If this option is specified then any other --strip-* or
205 --keep-* options are ignored.
206
207
208 --strip-com
209 Strip Comment (COM) markers from output file.
210
211 --strip-exif
212 Strip EXIF markers from output file.
213
214 --strip-iptc
215 Strip IPTC / Adobe Photoshop (APP13) markers from output file.
216
217 --strip-icc
218 Strip ICC profiles from output file.
219
220 --strip-xmp
221 Strip XMP profiles from output file.
222
223 --strip-jfxx
224 Strip JFXX (JFIF Extensions) from output file.
225
226 --strip-Adobe
227 Strip Adobe markers from output file.
228
229
230
231 --keep-com
232 Do not strip any Comment (COM) markers from output file.
233
234 --keep-exif
235 Do not strip any EXIF markers from output file.
236
237 --keep-iptc
238 Do not strip any IPTC / Adobe Photoshop (APP13) markers from out‐
239 put file.
240
241 --keep-icc
242 Do not strip any ICC profiles from output file.
243
244 --keep-xmp
245 Do not strip any XMP profiles from output file.
246
247 --strip-jfxx
248 Do not strip any JFXX (JFIF Extensions) from output file.
249
250 --keep-Adobe
251 Do not strip Adobe markers from output file.
252
253
254
255
257 When using --size option, resulting file is not always exactly the re‐
258 quested size. Workaround is to re-run jpegoptim on the same file again
259 which often will result file closer to target size.
260
261
263 jpeginfo(1)
264
265
267 Timo Kokkonen <tjko@iki.fi>
268
269
271 Copyright (C) 1996-2022 Timo Kokkonen
272
273 This program is free software; you can redistribute it and/or modify it
274 under the terms of the GNU General Public License as published by the
275 Free Software Foundation; either version 2 of the License, or (at your
276 option) any later version.
277 This program is distributed in the hope that it will be useful, but
278 WITHOUT ANY WARRANTY; without even the implied warranty of MER‐
279 CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
280 Public License for more details.
281 You should have received a copy of the GNU General Public License
282 along with this program; if not, write to the Free Software Foundation,
283 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
284
285
286
2874th Berkeley Distribution 14 Sep 2022 JPEGOPTIM(1)