Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 1 | .TH DJPEG 1 "22 August 1997" |
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 |
| 65 | 1/1, 1/2, 1/4, or 1/8. Scaling is handy if the image is larger than your |
| 66 | screen; also, |
| 67 | .B djpeg |
| 68 | runs much faster when scaling down the output. |
| 69 | .TP |
| 70 | .B \-bmp |
| 71 | Select BMP output format (Windows flavor). 8-bit colormapped format is |
| 72 | emitted if |
| 73 | .B \-colors |
| 74 | or |
| 75 | .B \-grayscale |
| 76 | is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color |
| 77 | format is emitted. |
| 78 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 79 | .B \-gif |
| 80 | Select GIF output format. Since GIF does not support more than 256 colors, |
| 81 | .B \-colors 256 |
| 82 | is assumed (unless you specify a smaller number of colors). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 83 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 84 | .B \-os2 |
| 85 | Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is |
| 86 | emitted if |
| 87 | .B \-colors |
| 88 | or |
| 89 | .B \-grayscale |
| 90 | is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color |
| 91 | format is emitted. |
| 92 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 93 | .B \-pnm |
| 94 | Select PBMPLUS (PPM/PGM) output format (this is the default format). |
| 95 | PGM is emitted if the JPEG file is gray-scale or if |
| 96 | .B \-grayscale |
| 97 | is specified; otherwise PPM is emitted. |
| 98 | .TP |
| 99 | .B \-rle |
| 100 | Select RLE output format. (Requires URT library.) |
| 101 | .TP |
| 102 | .B \-targa |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 103 | Select Targa output format. Gray-scale format is emitted if the JPEG file is |
| 104 | gray-scale or if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 105 | .B \-grayscale |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 106 | is specified; otherwise, colormapped format is emitted if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 107 | .B \-colors |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 108 | is specified; otherwise, 24-bit full-color format is emitted. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 109 | .PP |
| 110 | Switches for advanced users: |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 111 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 112 | .B \-dct int |
| 113 | Use integer DCT method (default). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 114 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 115 | .B \-dct fast |
| 116 | Use fast integer DCT (less accurate). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 117 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 118 | .B \-dct float |
| 119 | Use floating-point DCT method. |
Thomas G. Lane | a8b67c4 | 1995-03-15 00:00:00 +0000 | [diff] [blame] | 120 | The float method is very slightly more accurate than the int method, but is |
| 121 | much slower unless your machine has very fast floating-point hardware. Also |
| 122 | note that results of the floating-point method may vary slightly across |
| 123 | machines, while the integer methods should give the same results everywhere. |
| 124 | The fast integer method is much less accurate than the other two. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 125 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 126 | .B \-dither fs |
| 127 | Use Floyd-Steinberg dithering in color quantization. |
| 128 | .TP |
| 129 | .B \-dither ordered |
| 130 | Use ordered dithering in color quantization. |
| 131 | .TP |
| 132 | .B \-dither none |
| 133 | Do not use dithering in color quantization. |
| 134 | By default, Floyd-Steinberg dithering is applied when quantizing colors; this |
| 135 | is slow but usually produces the best results. Ordered dither is a compromise |
| 136 | between speed and quality; no dithering is fast but usually looks awful. Note |
| 137 | that these switches have no effect unless color quantization is being done. |
| 138 | Ordered dither is only available in |
| 139 | .B \-onepass |
| 140 | mode. |
| 141 | .TP |
| 142 | .BI \-map " file" |
| 143 | Quantize to the colors used in the specified image file. This is useful for |
| 144 | producing multiple files with identical color maps, or for forcing a |
| 145 | predefined set of colors to be used. The |
| 146 | .I file |
| 147 | must be a GIF or PPM file. This option overrides |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 148 | .B \-colors |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 149 | and |
| 150 | .BR \-onepass . |
| 151 | .TP |
| 152 | .B \-nosmooth |
| 153 | Use a faster, lower-quality upsampling routine. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 154 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 155 | .B \-onepass |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 156 | Use one-pass instead of two-pass color quantization. The one-pass method is |
| 157 | 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] | 158 | .B \-onepass |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 159 | is ignored unless you also say |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 160 | .B \-colors |
| 161 | .IR N . |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 162 | Also, the one-pass method is always used for gray-scale output (the two-pass |
| 163 | method is no improvement then). |
| 164 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 165 | .BI \-maxmemory " N" |
| 166 | Set limit for amount of memory to use in processing large images. Value is |
| 167 | in thousands of bytes, or millions of bytes if "M" is attached to the |
| 168 | number. For example, |
| 169 | .B \-max 4m |
| 170 | selects 4000000 bytes. If more space is needed, temporary files will be used. |
| 171 | .TP |
| 172 | .BI \-outfile " name" |
| 173 | Send output image to the named file, not to standard output. |
| 174 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 175 | .B \-verbose |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 176 | Enable debug printout. More |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 177 | .BR \-v 's |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 178 | give more output. Also, version information is printed at startup. |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 179 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 180 | .B \-debug |
| 181 | Same as |
| 182 | .BR \-verbose . |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 183 | .SH EXAMPLES |
| 184 | .LP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 185 | This example decompresses the JPEG file foo.jpg, quantizes it to |
| 186 | 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] | 187 | .IP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 188 | .B djpeg \-colors 256 \-bmp |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 189 | .I foo.jpg |
| 190 | .B > |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 191 | .I foo.bmp |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 192 | .SH HINTS |
| 193 | To get a quick preview of an image, use the |
| 194 | .B \-grayscale |
| 195 | and/or |
| 196 | .B \-scale |
| 197 | switches. |
| 198 | .B \-grayscale \-scale 1/8 |
| 199 | is the fastest case. |
| 200 | .PP |
| 201 | Several options are available that trade off image quality to gain speed. |
| 202 | .B \-fast |
| 203 | turns on the recommended settings. |
| 204 | .PP |
| 205 | .B \-dct fast |
| 206 | and/or |
| 207 | .B \-nosmooth |
| 208 | gain speed at a small sacrifice in quality. |
| 209 | When producing a color-quantized image, |
| 210 | .B \-onepass \-dither ordered |
| 211 | is fast but much lower quality than the default behavior. |
| 212 | .B \-dither none |
| 213 | may give acceptable results in two-pass mode, but is seldom tolerable in |
| 214 | one-pass mode. |
| 215 | .PP |
| 216 | 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] | 217 | \fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most |
| 218 | machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is |
| 219 | not worth using, because its theoretical accuracy advantage is too small to be |
| 220 | significant in practice. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 221 | .SH ENVIRONMENT |
| 222 | .TP |
| 223 | .B JPEGMEM |
| 224 | If this environment variable is set, its value is the default memory limit. |
| 225 | The value is specified as described for the |
| 226 | .B \-maxmemory |
| 227 | switch. |
| 228 | .B JPEGMEM |
| 229 | overrides the default value specified when the program was compiled, and |
| 230 | itself is overridden by an explicit |
| 231 | .BR \-maxmemory . |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 232 | .SH SEE ALSO |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 233 | .BR cjpeg (1), |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 234 | .BR jpegtran (1), |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 235 | .BR rdjpgcom (1), |
| 236 | .BR wrjpgcom (1) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 237 | .br |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 238 | .BR ppm (5), |
| 239 | .BR pgm (5) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 240 | .br |
| 241 | Wallace, Gregory K. "The JPEG Still Picture Compression Standard", |
| 242 | Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. |
| 243 | .SH AUTHOR |
| 244 | Independent JPEG Group |
| 245 | .SH BUGS |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 246 | Arithmetic coding is not supported for legal reasons. |
| 247 | .PP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 248 | To avoid the Unisys LZW patent, |
| 249 | .B djpeg |
| 250 | produces uncompressed GIF files. These are larger than they should be, but |
| 251 | are readable by standard GIF decoders. |
| 252 | .PP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 253 | Still not as fast as we'd like. |