DRC | 8940e6c | 2014-05-11 09:46:28 +0000 | [diff] [blame^] | 1 | .TH DJPEG 1 "11 May 2014" |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 2 | .SH NAME |
| 3 | djpeg \- decompress a JPEG file to an image file |
| 4 | .SH SYNOPSIS |
| 5 | .B djpeg |
| 6 | [ |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 7 | .I options |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 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, |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 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.) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 20 | .SH OPTIONS |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 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 |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 29 | .B \-BMP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 30 | is the same as |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 31 | .BR \-bmp ). |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 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: |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 37 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 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. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 43 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 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. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 51 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 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 gray-scale 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 | .BI \-scale " M/N" |
| 64 | Scale the output image by a factor M/N. Currently the scale factor must be |
DRC | 27fb3fc | 2012-01-28 01:48:07 +0000 | [diff] [blame] | 65 | M/8, where M is an integer between 1 and 16 inclusive, or any reduced fraction |
| 66 | thereof (such as 1/2, 3/4, etc.) Scaling is handy if the image is larger than |
| 67 | your screen; also, |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 68 | .B djpeg |
| 69 | runs much faster when scaling down the output. |
| 70 | .TP |
| 71 | .B \-bmp |
| 72 | Select BMP output format (Windows flavor). 8-bit colormapped format is |
| 73 | emitted if |
| 74 | .B \-colors |
| 75 | or |
| 76 | .B \-grayscale |
| 77 | is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color |
| 78 | format is emitted. |
| 79 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 80 | .B \-gif |
| 81 | Select GIF output format. Since GIF does not support more than 256 colors, |
| 82 | .B \-colors 256 |
| 83 | is assumed (unless you specify a smaller number of colors). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 84 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 85 | .B \-os2 |
| 86 | Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is |
| 87 | emitted if |
| 88 | .B \-colors |
| 89 | or |
| 90 | .B \-grayscale |
| 91 | is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color |
| 92 | format is emitted. |
| 93 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 94 | .B \-pnm |
| 95 | Select PBMPLUS (PPM/PGM) output format (this is the default format). |
| 96 | PGM is emitted if the JPEG file is gray-scale or if |
| 97 | .B \-grayscale |
| 98 | is specified; otherwise PPM is emitted. |
| 99 | .TP |
| 100 | .B \-rle |
| 101 | Select RLE output format. (Requires URT library.) |
| 102 | .TP |
| 103 | .B \-targa |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 104 | Select Targa output format. Gray-scale format is emitted if the JPEG file is |
| 105 | gray-scale or if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 106 | .B \-grayscale |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 107 | is specified; otherwise, colormapped format is emitted if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 108 | .B \-colors |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 109 | is specified; otherwise, 24-bit full-color format is emitted. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 110 | .PP |
| 111 | Switches for advanced users: |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 112 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 113 | .B \-dct int |
| 114 | Use integer DCT method (default). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 115 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 116 | .B \-dct fast |
| 117 | Use fast integer DCT (less accurate). |
DRC | 8940e6c | 2014-05-11 09:46:28 +0000 | [diff] [blame^] | 118 | In libjpeg-turbo, the fast method is generally about 5-15% faster than the int |
| 119 | method when using the x86/x86-64 SIMD extensions (results may vary with other |
| 120 | SIMD implementations, or when using libjpeg-turbo without SIMD extensions.) If |
| 121 | the JPEG image was compressed using a quality level of 85 or below, then there |
| 122 | should be little or no perceptible difference between the two algorithms. When |
| 123 | decompressing images that were compressed using quality levels above 85, |
| 124 | however, the difference between the fast and int methods becomes more |
| 125 | pronounced. With images compressed using quality=97, for instance, the fast |
| 126 | method incurs generally about a 4-6 dB loss (in PSNR) relative to the int |
| 127 | method, but this can be larger for some images. If you can avoid it, do not |
| 128 | use the fast method when decompressing images that were compressed using |
| 129 | quality levels above 97. The algorithm often degenerates for such images and |
| 130 | can actually produce a more lossy output image than if the JPEG image had been |
| 131 | compressed using lower quality levels. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 132 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 133 | .B \-dct float |
| 134 | Use floating-point DCT method. |
DRC | 8940e6c | 2014-05-11 09:46:28 +0000 | [diff] [blame^] | 135 | The float method is mostly a legacy feature. It does not produce significantly |
| 136 | more accurate results than the int method, and it is much slower. The float |
| 137 | method may also give different results on different machines due to varying |
| 138 | roundoff behavior, whereas the integer methods should give the same results on |
| 139 | all machines. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 140 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 141 | .B \-dither fs |
| 142 | Use Floyd-Steinberg dithering in color quantization. |
| 143 | .TP |
| 144 | .B \-dither ordered |
| 145 | Use ordered dithering in color quantization. |
| 146 | .TP |
| 147 | .B \-dither none |
| 148 | Do not use dithering in color quantization. |
| 149 | By default, Floyd-Steinberg dithering is applied when quantizing colors; this |
| 150 | is slow but usually produces the best results. Ordered dither is a compromise |
| 151 | between speed and quality; no dithering is fast but usually looks awful. Note |
| 152 | that these switches have no effect unless color quantization is being done. |
| 153 | Ordered dither is only available in |
| 154 | .B \-onepass |
| 155 | mode. |
| 156 | .TP |
| 157 | .BI \-map " file" |
| 158 | Quantize to the colors used in the specified image file. This is useful for |
| 159 | producing multiple files with identical color maps, or for forcing a |
| 160 | predefined set of colors to be used. The |
| 161 | .I file |
| 162 | must be a GIF or PPM file. This option overrides |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 163 | .B \-colors |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 164 | and |
| 165 | .BR \-onepass . |
| 166 | .TP |
| 167 | .B \-nosmooth |
| 168 | Use a faster, lower-quality upsampling routine. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 169 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 170 | .B \-onepass |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 171 | Use one-pass instead of two-pass color quantization. The one-pass method is |
| 172 | faster and needs less memory, but it produces a lower-quality image. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 173 | .B \-onepass |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 174 | is ignored unless you also say |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 175 | .B \-colors |
| 176 | .IR N . |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 177 | Also, the one-pass method is always used for gray-scale output (the two-pass |
| 178 | method is no improvement then). |
| 179 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 180 | .BI \-maxmemory " N" |
| 181 | Set limit for amount of memory to use in processing large images. Value is |
| 182 | in thousands of bytes, or millions of bytes if "M" is attached to the |
| 183 | number. For example, |
| 184 | .B \-max 4m |
| 185 | selects 4000000 bytes. If more space is needed, temporary files will be used. |
| 186 | .TP |
| 187 | .BI \-outfile " name" |
| 188 | Send output image to the named file, not to standard output. |
| 189 | .TP |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 190 | .BI \-memsrc |
| 191 | Load input file into memory before decompressing. This feature was implemented |
| 192 | mainly as a way of testing the in-memory source manager (jpeg_mem_src().) |
| 193 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 194 | .B \-verbose |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 195 | Enable debug printout. More |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 196 | .BR \-v 's |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 197 | give more output. Also, version information is printed at startup. |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 198 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 199 | .B \-debug |
| 200 | Same as |
| 201 | .BR \-verbose . |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 202 | .SH EXAMPLES |
| 203 | .LP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 204 | This example decompresses the JPEG file foo.jpg, quantizes it to |
| 205 | 256 colors, and saves the output in 8-bit BMP format in foo.bmp: |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 206 | .IP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 207 | .B djpeg \-colors 256 \-bmp |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 208 | .I foo.jpg |
| 209 | .B > |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 210 | .I foo.bmp |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 211 | .SH HINTS |
| 212 | To get a quick preview of an image, use the |
| 213 | .B \-grayscale |
| 214 | and/or |
| 215 | .B \-scale |
| 216 | switches. |
| 217 | .B \-grayscale \-scale 1/8 |
| 218 | is the fastest case. |
| 219 | .PP |
| 220 | Several options are available that trade off image quality to gain speed. |
| 221 | .B \-fast |
| 222 | turns on the recommended settings. |
| 223 | .PP |
| 224 | .B \-dct fast |
| 225 | and/or |
| 226 | .B \-nosmooth |
| 227 | gain speed at a small sacrifice in quality. |
| 228 | When producing a color-quantized image, |
| 229 | .B \-onepass \-dither ordered |
| 230 | is fast but much lower quality than the default behavior. |
| 231 | .B \-dither none |
| 232 | may give acceptable results in two-pass mode, but is seldom tolerable in |
| 233 | one-pass mode. |
| 234 | .PP |
| 235 | If you are fortunate enough to have very fast floating point hardware, |
Thomas G. Lane | a8b67c4 | 1995-03-15 00:00:00 +0000 | [diff] [blame] | 236 | \fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most |
| 237 | machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is |
| 238 | not worth using, because its theoretical accuracy advantage is too small to be |
| 239 | significant in practice. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 240 | .SH ENVIRONMENT |
| 241 | .TP |
| 242 | .B JPEGMEM |
| 243 | If this environment variable is set, its value is the default memory limit. |
| 244 | The value is specified as described for the |
| 245 | .B \-maxmemory |
| 246 | switch. |
| 247 | .B JPEGMEM |
| 248 | overrides the default value specified when the program was compiled, and |
| 249 | itself is overridden by an explicit |
| 250 | .BR \-maxmemory . |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 251 | .SH SEE ALSO |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 252 | .BR cjpeg (1), |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 253 | .BR jpegtran (1), |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 254 | .BR rdjpgcom (1), |
| 255 | .BR wrjpgcom (1) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 256 | .br |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 257 | .BR ppm (5), |
| 258 | .BR pgm (5) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 259 | .br |
| 260 | Wallace, Gregory K. "The JPEG Still Picture Compression Standard", |
| 261 | Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. |
| 262 | .SH AUTHOR |
| 263 | Independent JPEG Group |
DRC | cf763c0 | 2013-01-01 09:51:37 +0000 | [diff] [blame] | 264 | .PP |
| 265 | This file was modified by The libjpeg-turbo Project to include only information |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 266 | relevant to libjpeg-turbo, to wordsmith certain sections, and to describe |
| 267 | features not present in libjpeg. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 268 | .SH BUGS |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 269 | To avoid the Unisys LZW patent, |
| 270 | .B djpeg |
| 271 | produces uncompressed GIF files. These are larger than they should be, but |
| 272 | are readable by standard GIF decoders. |