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 assumed when this option is used). When this
153 option is used then only one image is read from standard input.
154 Any (other) input files specified on command-line are ignored.
155 Note, if input file '-' is seen on command line then standard in‐
156 put is also assumed.
157
158
159 --files-stdin
160 Read names of files to process from standard input. One filename
161 per line.
162
163
164 --files-from=<filename>
165 Read names of files to process from a file. One filename per
166 line.
167
168
169
171 By default jpetoptim will keep common metadata (JPEG markers) and dis‐
172 card any other (unknown ones).
173
174 Following markers are kept by default:
175 - EXIF
176 - IPTC
177 - ICC
178 - XMP
179 - COM (JPEG Comment markers)
180
181 JFIF marker will be regenerated (by libjpeg) during the process (this
182 cannot be changed). However, Adobe marker is also generated (or omit‐
183 ted) by libjpeg based on the image colorspace, etc. This behavior de‐
184 pends on libjpeg library version being used. To make sure Adobe marker
185 is preserved option --keep-adobe can be used.
186
187 To remove additional markers one or more the --strip-* options can be
188 used.
189
190 For example: --strip-icc --strip-xmp --strip-com
191
192
193 Alternatively it is possible to specify --strip-all and then one or
194 more of the --keep-* options to explicitly list which markers to keep
195
196 For example: --strip-all --keep-exif --keep-iptc
197
198
199 Options for controlling metadata (markers) in output files:
200
201
202 -s, --strip-all
203 Strip all markers from output file. (NOTE! by default only Com‐
204 ment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything
205 else is discarded). Output JPEG still likely will contains one
206 or two markers (JFIF and Adobe APP14) depending on colorspace
207 used in the image, as these markers are generated by the libjpeg
208 encoder automatically.
209
210 --strip-none
211 Preserve "all" markers in the image. This will leave all markers
212 untouched in the image, except JFIF (APP0) and Adobe (APP14)
213 markers as those get regenerated by the libjpeg library.
214
215 NOTE! If this option is specified then any other --strip-* or
216 --keep-* options are ignored.
217
218
219 --strip-com
220 Strip Comment (COM) markers from output file.
221
222 --strip-exif
223 Strip EXIF markers from output file.
224
225 --strip-iptc
226 Strip IPTC / Adobe Photoshop (APP13) markers from output file.
227
228 --strip-icc
229 Strip ICC profiles from output file.
230
231 --strip-xmp
232 Strip XMP profiles from output file.
233
234 --strip-jfxx
235 Strip JFXX (JFIF Extensions) from output file.
236
237 --strip-Adobe
238 Strip Adobe markers from output file.
239
240
241
242 --keep-com
243 Do not strip any Comment (COM) markers from output file.
244
245 --keep-exif
246 Do not strip any EXIF markers from output file.
247
248 --keep-iptc
249 Do not strip any IPTC / Adobe Photoshop (APP13) markers from out‐
250 put file.
251
252 --keep-icc
253 Do not strip any ICC profiles from output file.
254
255 --keep-xmp
256 Do not strip any XMP profiles from output file.
257
258 --strip-jfxx
259 Do not strip any JFXX (JFIF Extensions) from output file.
260
261 --keep-Adobe
262 Do not strip Adobe markers from output file.
263
264
265
266
268 When using --size option, resulting file is not always exactly the re‐
269 quested size. Workaround is to re-run jpegoptim on the same file again
270 which often will result file closer to target size.
271
272
274 jpeginfo(1)
275
276
278 Timo Kokkonen <tjko@iki.fi>
279
280
282 Copyright (C) 1996-2022 Timo Kokkonen
283
284 This program is free software; you can redistribute it and/or modify it
285 under the terms of the GNU General Public License as published by the
286 Free Software Foundation; either version 2 of the License, or (at your
287 option) any later version.
288 This program is distributed in the hope that it will be useful, but
289 WITHOUT ANY WARRANTY; without even the implied warranty of MER‐
290 CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
291 Public License for more details.
292 You should have received a copy of the GNU General Public License
293 along with this program; if not, write to the Free Software Foundation,
294 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
295
296
297
2984th Berkeley Distribution 14 Sep 2022 JPEGOPTIM(1)