jpegoptim.1 9.4 KB

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