jpegoptim.1 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. .TH JPEGOPTIM 1 "21 Jun 2023"
  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 -t, --totals
  92. Print totals after processing all files.
  93. .TP 0.6i
  94. .B -v, --verbose
  95. Enables verbose mode (positively chatty).
  96. .TP 0.6i
  97. .B --all-normal
  98. Force all output files to be non-progressive. Can be used to convert
  99. all input files to non-progressive JPEGs when used with --force option.
  100. .TP 0.6i
  101. .B --all-progressive
  102. Force all output files to be progressive. Can be used to convert
  103. all normal (non-progressive) JPEGs input files to progressive when used with --force option.
  104. .TP 0.6i
  105. .B --all-arith
  106. Force all output files to use Arithmetic Coding.
  107. This option is experimental and only available if jpegoptim was compiled with
  108. Arithmetic Coding support enabled.
  109. .TP 0.6i
  110. .B --all-huffman
  111. Force all output files to use (traditional) Huffman coding.
  112. This option is experimental and only available if jpegoptim was compiled with
  113. Arithmetic Coding support enabled.
  114. .TP 0.6i
  115. .B --nofix
  116. Skip processing of any input files that have any errors/warnings during decompression.
  117. By default jpegoptim will attempt to optimize any file that it is able to decompress,
  118. even if decompression generates warnings. This will 'fix' some (corrupt) JPEG images
  119. automatically.
  120. If this behaviour is not desired, this option can be used to make jpegoptim to skip
  121. any input files that contain any errors.
  122. .TP 0.6i
  123. .B --stdout
  124. Send output image to standard output. Note, if optimization didn't create smaller file
  125. than the input file, then no output original image is passed through unmodified
  126. (except any extra data after JPEG image will be discarded).
  127. .TP 0.6i
  128. .B --stdin
  129. Read input image from standard input and send output to standard output (--stdout is
  130. assumed when this option is used).
  131. When this option is used then only one image is read from standard input.
  132. Any (other) input files specified on command-line are ignored.
  133. Note, if input file '-' is seen on command line then standard input is also assumed.
  134. .TP 0.6i
  135. .B --files-stdin
  136. Read names of files to process from standard input. One filename per line.
  137. .TP 0.6i
  138. .B --files-from=<filename>
  139. Read names of files to process from a file. One filename per line.
  140. .SH METADATA OPTIONS
  141. .PP
  142. By default jpetoptim will keep common metadata (JPEG markers) and discard any other (unknown ones).
  143. Following markers are kept by default:
  144. - EXIF
  145. - IPTC
  146. - ICC
  147. - XMP
  148. - COM (JPEG Comment markers)
  149. JFIF marker will be regenerated (by libjpeg) during the process (this cannot be changed).
  150. However, Adobe marker is also generated (or omitted) by libjpeg based on the image colorspace, etc.
  151. This behavior depends on libjpeg library version being used. To make sure Adobe marker is preserved
  152. option --keep-adobe can be used.
  153. To remove additional markers one or more the --strip-* options can be used.
  154. .PP
  155. For example:
  156. --strip-icc --strip-xmp --strip-com
  157. Alternatively it is possible to specify --strip-all and then one or more of the --keep-* options
  158. to explicitly list which markers to keep
  159. .PP
  160. For example:
  161. --strip-all --keep-exif --keep-iptc
  162. .PP
  163. Options for controlling metadata (markers) in output files:
  164. .TP 0.6i
  165. .B -s, --strip-all
  166. Strip all markers from output file. (NOTE! by default
  167. only Comment & Exif/IPTC/PhotoShop/ICC/XMP markers are kept, everything else is discarded).
  168. Output JPEG still likely will contains one or two markers (JFIF and Adobe APP14) depending
  169. on colorspace used in the image, as these markers are generated by the libjpeg encoder
  170. automatically.
  171. .TP 0.6i
  172. .B --strip-none, --keep-all
  173. Preserve "all" markers in the image. This will leave all markers untouched in the image,
  174. except JFIF (APP0) and Adobe (APP14) markers as those get regenerated by the libjpeg library.
  175. NOTE! If this option is specified then any other --strip-* or --keep-* options are ignored.
  176. .TP 0.6i
  177. .B --strip-com
  178. Strip Comment (COM) markers from output file.
  179. .TP 0.6i
  180. .B --strip-exif
  181. Strip EXIF markers from output file.
  182. .TP 0.6i
  183. .B --strip-iptc
  184. Strip IPTC / Adobe Photoshop (APP13) markers from output file.
  185. .TP 0.6i
  186. .B --strip-icc
  187. Strip ICC profiles from output file.
  188. .TP 0.6i
  189. .B --strip-xmp
  190. Strip XMP profiles from output file.
  191. .TP 0.6i
  192. .B --strip-jfif
  193. Strip JFIF markers from output file.
  194. .TP 0.6i
  195. .B --strip-jfxx
  196. Strip JFXX (JFIF Extensions) markers from output file.
  197. .TP 0.6i
  198. .B --strip-Adobe
  199. Strip Adobe markers from output file.
  200. .TP 0.6i
  201. .B --keep-com
  202. Do not strip any Comment (COM) markers from output file.
  203. .TP 0.6i
  204. .B --keep-exif
  205. Do not strip any EXIF markers from output file.
  206. .TP 0.6i
  207. .B --keep-iptc
  208. Do not strip any IPTC / Adobe Photoshop (APP13) markers from output file.
  209. .TP 0.6i
  210. .B --keep-icc
  211. Do not strip any ICC profiles from output file.
  212. .TP 0.6i
  213. .B --keep-xmp
  214. Do not strip any XMP profiles from output file.
  215. .TP 0.6i
  216. .B --strip-jfif
  217. Do not strip any JFIF markers from output file.
  218. .TP 0.6i
  219. .B --strip-jfxx
  220. Do not strip any JFXX (JFIF Extensions) markers from output file.
  221. .TP 0.6i
  222. .B --keep-Adobe
  223. Do not strip Adobe markers from output file.
  224. .SH BUGS
  225. When using --size option, resulting file is not always exactly the
  226. requested size. Workaround is to re-run jpegoptim on the same file again
  227. which often will result file closer to target size.
  228. .SH "SEE ALSO"
  229. jpeginfo(1)
  230. .SH AUTHOR
  231. Timo Kokkonen <tjko@iki.fi>
  232. .SH COPYING
  233. Copyright (C) 1996-2023 Timo Kokkonen
  234. This program is free software; you can redistribute it and/or modify
  235. it under the terms of the GNU General Public License as published by
  236. the Free Software Foundation; either version 2 of the License, or
  237. (at your option) any later version.
  238. This program is distributed in the hope that it will be useful,
  239. but WITHOUT ANY WARRANTY; without even the implied warranty of
  240. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  241. GNU General Public License for more details.
  242. You should have received a copy of the GNU General Public License
  243. along with this program; if not, write to the Free Software
  244. Foundation, Inc.,
  245. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.