djpeg.1 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. .TH DJPEG 1 "13 November 2017"
  2. .SH NAME
  3. djpeg \- decompress a JPEG file to an image file
  4. .SH SYNOPSIS
  5. .B djpeg
  6. [
  7. .I options
  8. ]
  9. [
  10. .I filename
  11. ]
  12. .LP
  13. .SH DESCRIPTION
  14. .LP
  15. .B djpeg
  16. decompresses the named JPEG file, or the standard input if no file is named,
  17. and produces an image file on the standard output. PBMPLUS (PPM/PGM), BMP,
  18. GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected.
  19. (RLE is supported only if the URT library is available.)
  20. .SH OPTIONS
  21. All switch names may be abbreviated; for example,
  22. .B \-grayscale
  23. may be written
  24. .B \-gray
  25. or
  26. .BR \-gr .
  27. Most of the "basic" switches can be abbreviated to as little as one letter.
  28. Upper and lower case are equivalent (thus
  29. .B \-BMP
  30. is the same as
  31. .BR \-bmp ).
  32. British spellings are also accepted (e.g.,
  33. .BR \-greyscale ),
  34. though for brevity these are not mentioned below.
  35. .PP
  36. The basic switches are:
  37. .TP
  38. .BI \-colors " N"
  39. Reduce image to at most N colors. This reduces the number of colors used in
  40. the output image, so that it can be displayed on a colormapped display or
  41. stored in a colormapped file format. For example, if you have an 8-bit
  42. display, you'd need to reduce to 256 or fewer colors.
  43. .TP
  44. .BI \-quantize " N"
  45. Same as
  46. .BR \-colors .
  47. .B \-colors
  48. is the recommended name,
  49. .B \-quantize
  50. is provided only for backwards compatibility.
  51. .TP
  52. .B \-fast
  53. Select recommended processing options for fast, low quality output. (The
  54. default options are chosen for highest quality output.) Currently, this is
  55. equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR.
  56. .TP
  57. .B \-grayscale
  58. Force grayscale output even if JPEG file is color. Useful for viewing on
  59. monochrome displays; also,
  60. .B djpeg
  61. runs noticeably faster in this mode.
  62. .TP
  63. .B \-rgb
  64. Force RGB output even if JPEG file is grayscale.
  65. .TP
  66. .BI \-scale " M/N"
  67. Scale the output image by a factor M/N. Currently the scale factor must be
  68. M/8, where M is an integer between 1 and 16 inclusive, or any reduced fraction
  69. thereof (such as 1/2, 3/4, etc.) Scaling is handy if the image is larger than
  70. your screen; also,
  71. .B djpeg
  72. runs much faster when scaling down the output.
  73. .TP
  74. .B \-bmp
  75. Select BMP output format (Windows flavor). 8-bit colormapped format is
  76. emitted if
  77. .B \-colors
  78. or
  79. .B \-grayscale
  80. is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
  81. format is emitted.
  82. .TP
  83. .B \-gif
  84. Select GIF output format. Since GIF does not support more than 256 colors,
  85. .B \-colors 256
  86. is assumed (unless you specify a smaller number of colors).
  87. .TP
  88. .B \-os2
  89. Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is
  90. emitted if
  91. .B \-colors
  92. or
  93. .B \-grayscale
  94. is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
  95. format is emitted.
  96. .TP
  97. .B \-pnm
  98. Select PBMPLUS (PPM/PGM) output format (this is the default format).
  99. PGM is emitted if the JPEG file is grayscale or if
  100. .B \-grayscale
  101. is specified; otherwise PPM is emitted.
  102. .TP
  103. .B \-rle
  104. Select RLE output format. (Requires URT library.)
  105. .TP
  106. .B \-targa
  107. Select Targa output format. Grayscale format is emitted if the JPEG file is
  108. grayscale or if
  109. .B \-grayscale
  110. is specified; otherwise, colormapped format is emitted if
  111. .B \-colors
  112. is specified; otherwise, 24-bit full-color format is emitted.
  113. .PP
  114. Switches for advanced users:
  115. .TP
  116. .B \-dct int
  117. Use integer DCT method (default).
  118. .TP
  119. .B \-dct fast
  120. Use fast integer DCT (less accurate).
  121. In libjpeg-turbo, the fast method is generally about 5-15% faster than the int
  122. method when using the x86/x86-64 SIMD extensions (results may vary with other
  123. SIMD implementations, or when using libjpeg-turbo without SIMD extensions.) If
  124. the JPEG image was compressed using a quality level of 85 or below, then there
  125. should be little or no perceptible difference between the two algorithms. When
  126. decompressing images that were compressed using quality levels above 85,
  127. however, the difference between the fast and int methods becomes more
  128. pronounced. With images compressed using quality=97, for instance, the fast
  129. method incurs generally about a 4-6 dB loss (in PSNR) relative to the int
  130. method, but this can be larger for some images. If you can avoid it, do not
  131. use the fast method when decompressing images that were compressed using
  132. quality levels above 97. The algorithm often degenerates for such images and
  133. can actually produce a more lossy output image than if the JPEG image had been
  134. compressed using lower quality levels.
  135. .TP
  136. .B \-dct float
  137. Use floating-point DCT method.
  138. The float method is mainly a legacy feature. It does not produce significantly
  139. more accurate results than the int method, and it is much slower. The float
  140. method may also give different results on different machines due to varying
  141. roundoff behavior, whereas the integer methods should give the same results on
  142. all machines.
  143. .TP
  144. .B \-dither fs
  145. Use Floyd-Steinberg dithering in color quantization.
  146. .TP
  147. .B \-dither ordered
  148. Use ordered dithering in color quantization.
  149. .TP
  150. .B \-dither none
  151. Do not use dithering in color quantization.
  152. By default, Floyd-Steinberg dithering is applied when quantizing colors; this
  153. is slow but usually produces the best results. Ordered dither is a compromise
  154. between speed and quality; no dithering is fast but usually looks awful. Note
  155. that these switches have no effect unless color quantization is being done.
  156. Ordered dither is only available in
  157. .B \-onepass
  158. mode.
  159. .TP
  160. .BI \-icc " file"
  161. Extract ICC color management profile to the specified file.
  162. .TP
  163. .BI \-map " file"
  164. Quantize to the colors used in the specified image file. This is useful for
  165. producing multiple files with identical color maps, or for forcing a
  166. predefined set of colors to be used. The
  167. .I file
  168. must be a GIF or PPM file. This option overrides
  169. .B \-colors
  170. and
  171. .BR \-onepass .
  172. .TP
  173. .B \-nosmooth
  174. Use a faster, lower-quality upsampling routine.
  175. .TP
  176. .B \-onepass
  177. Use one-pass instead of two-pass color quantization. The one-pass method is
  178. faster and needs less memory, but it produces a lower-quality image.
  179. .B \-onepass
  180. is ignored unless you also say
  181. .B \-colors
  182. .IR N .
  183. Also, the one-pass method is always used for grayscale output (the two-pass
  184. method is no improvement then).
  185. .TP
  186. .BI \-maxmemory " N"
  187. Set limit for amount of memory to use in processing large images. Value is
  188. in thousands of bytes, or millions of bytes if "M" is attached to the
  189. number. For example,
  190. .B \-max 4m
  191. selects 4000000 bytes. If more space is needed, an error will occur.
  192. .TP
  193. .BI \-outfile " name"
  194. Send output image to the named file, not to standard output.
  195. .TP
  196. .BI \-memsrc
  197. Load input file into memory before decompressing. This feature was implemented
  198. mainly as a way of testing the in-memory source manager (jpeg_mem_src().)
  199. .TP
  200. .BI \-skip " Y0,Y1"
  201. Decompress all rows of the JPEG image except those between Y0 and Y1
  202. (inclusive.) Note that if decompression scaling is being used, then Y0 and Y1
  203. are relative to the scaled image dimensions.
  204. .TP
  205. .BI \-crop " WxH+X+Y"
  206. Decompress only a rectangular subregion of the image, starting at point X,Y
  207. with width W and height H. If necessary, X will be shifted left to the nearest
  208. iMCU boundary, and the width will be increased accordingly. Note that if
  209. decompression scaling is being used, then X, Y, W, and H are relative to the
  210. scaled image dimensions. Currently this option only works with the
  211. PBMPLUS (PPM/PGM), GIF, and Targa output formats.
  212. .TP
  213. .B \-verbose
  214. Enable debug printout. More
  215. .BR \-v 's
  216. give more output. Also, version information is printed at startup.
  217. .TP
  218. .B \-debug
  219. Same as
  220. .BR \-verbose .
  221. .TP
  222. .B \-version
  223. Print version information and exit.
  224. .SH EXAMPLES
  225. .LP
  226. This example decompresses the JPEG file foo.jpg, quantizes it to
  227. 256 colors, and saves the output in 8-bit BMP format in foo.bmp:
  228. .IP
  229. .B djpeg \-colors 256 \-bmp
  230. .I foo.jpg
  231. .B >
  232. .I foo.bmp
  233. .SH HINTS
  234. To get a quick preview of an image, use the
  235. .B \-grayscale
  236. and/or
  237. .B \-scale
  238. switches.
  239. .B \-grayscale \-scale 1/8
  240. is the fastest case.
  241. .PP
  242. Several options are available that trade off image quality to gain speed.
  243. .B \-fast
  244. turns on the recommended settings.
  245. .PP
  246. .B \-dct fast
  247. and/or
  248. .B \-nosmooth
  249. gain speed at a small sacrifice in quality.
  250. When producing a color-quantized image,
  251. .B \-onepass \-dither ordered
  252. is fast but much lower quality than the default behavior.
  253. .B \-dither none
  254. may give acceptable results in two-pass mode, but is seldom tolerable in
  255. one-pass mode.
  256. .PP
  257. If you are fortunate enough to have very fast floating point hardware,
  258. \fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most
  259. machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
  260. not worth using, because its theoretical accuracy advantage is too small to be
  261. significant in practice.
  262. .SH ENVIRONMENT
  263. .TP
  264. .B JPEGMEM
  265. If this environment variable is set, its value is the default memory limit.
  266. The value is specified as described for the
  267. .B \-maxmemory
  268. switch.
  269. .B JPEGMEM
  270. overrides the default value specified when the program was compiled, and
  271. itself is overridden by an explicit
  272. .BR \-maxmemory .
  273. .SH SEE ALSO
  274. .BR cjpeg (1),
  275. .BR jpegtran (1),
  276. .BR rdjpgcom (1),
  277. .BR wrjpgcom (1)
  278. .br
  279. .BR ppm (5),
  280. .BR pgm (5)
  281. .br
  282. Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
  283. Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
  284. .SH AUTHOR
  285. Independent JPEG Group
  286. .PP
  287. This file was modified by The libjpeg-turbo Project to include only information
  288. relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
  289. features not present in libjpeg.
  290. .SH ISSUES
  291. Support for compressed GIF output files was removed in djpeg v6b due to
  292. concerns over the Unisys LZW patent. Although this patent expired in 2006,
  293. djpeg still lacks compressed GIF support, for these historical reasons.
  294. (Conversion of JPEG files to GIF is usually a bad idea anyway, since GIF is a
  295. 256-color format.) The uncompressed GIF files that djpeg generates are larger
  296. than they should be, but they are readable by standard GIF decoders.