DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1 | .TH DJPEG 1 "26 June 2015" |
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 |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 58 | Force grayscale output even if JPEG file is color. Useful for viewing on |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 59 | monochrome displays; also, |
| 60 | .B djpeg |
| 61 | runs noticeably faster in this mode. |
| 62 | .TP |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 63 | .B \-rgb |
| 64 | Force RGB output even if JPEG file is grayscale. |
| 65 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 66 | .BI \-scale " M/N" |
| 67 | 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] | 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, |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 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 |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 80 | is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 81 | format is emitted. |
| 82 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 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). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 87 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 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 |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 94 | is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 95 | format is emitted. |
| 96 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 97 | .B \-pnm |
| 98 | Select PBMPLUS (PPM/PGM) output format (this is the default format). |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 99 | PGM is emitted if the JPEG file is grayscale or if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 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 |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 107 | Select Targa output format. Grayscale format is emitted if the JPEG file is |
| 108 | grayscale or if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 109 | .B \-grayscale |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 110 | is specified; otherwise, colormapped format is emitted if |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 111 | .B \-colors |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 112 | is specified; otherwise, 24-bit full-color format is emitted. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 113 | .PP |
| 114 | Switches for advanced users: |
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 int |
| 117 | Use integer DCT method (default). |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 118 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 119 | .B \-dct fast |
| 120 | Use fast integer DCT (less accurate). |
DRC | 8940e6c | 2014-05-11 09:46:28 +0000 | [diff] [blame] | 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. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 135 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 136 | .B \-dct float |
| 137 | Use floating-point DCT method. |
DRC | 05524e6 | 2014-05-11 23:14:43 +0000 | [diff] [blame] | 138 | The float method is mainly a legacy feature. It does not produce significantly |
DRC | 8940e6c | 2014-05-11 09:46:28 +0000 | [diff] [blame] | 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. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 143 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 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 \-map " file" |
| 161 | Quantize to the colors used in the specified image file. This is useful for |
| 162 | producing multiple files with identical color maps, or for forcing a |
| 163 | predefined set of colors to be used. The |
| 164 | .I file |
| 165 | must be a GIF or PPM file. This option overrides |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 166 | .B \-colors |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 167 | and |
| 168 | .BR \-onepass . |
| 169 | .TP |
| 170 | .B \-nosmooth |
| 171 | Use a faster, lower-quality upsampling routine. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 172 | .TP |
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 | Use one-pass instead of two-pass color quantization. The one-pass method is |
| 175 | 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] | 176 | .B \-onepass |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 177 | is ignored unless you also say |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 178 | .B \-colors |
| 179 | .IR N . |
DRC | 90d6c38 | 2014-05-12 09:08:39 +0000 | [diff] [blame] | 180 | Also, the one-pass method is always used for grayscale output (the two-pass |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 181 | method is no improvement then). |
| 182 | .TP |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 183 | .BI \-maxmemory " N" |
| 184 | Set limit for amount of memory to use in processing large images. Value is |
| 185 | in thousands of bytes, or millions of bytes if "M" is attached to the |
| 186 | number. For example, |
| 187 | .B \-max 4m |
| 188 | selects 4000000 bytes. If more space is needed, temporary files will be used. |
| 189 | .TP |
| 190 | .BI \-outfile " name" |
| 191 | Send output image to the named file, not to standard output. |
| 192 | .TP |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 193 | .BI \-memsrc |
| 194 | Load input file into memory before decompressing. This feature was implemented |
| 195 | mainly as a way of testing the in-memory source manager (jpeg_mem_src().) |
| 196 | .TP |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 197 | .BI \-skip " Y0,Y1" |
| 198 | Decode all rows of the JPEG image except those between Y0 and Y1 (inclusive.) |
| 199 | Note that if decompression scaling is being used, Y0 and Y1 are relative to the |
| 200 | scaled image dimensions. |
| 201 | .TP |
| 202 | .BI \-strip " Y0,Y1" |
| 203 | Decode only the rows of the JPEG image between Y0 and Y1 (inclusive.) Note |
| 204 | that if decompression scaling is being used, Y0 and Y1 are relative to the |
| 205 | scaled image dimensions. |
| 206 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 207 | .B \-verbose |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 208 | Enable debug printout. More |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 209 | .BR \-v 's |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 210 | give more output. Also, version information is printed at startup. |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 211 | .TP |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 212 | .B \-debug |
| 213 | Same as |
| 214 | .BR \-verbose . |
DRC | 9665f5e | 2014-11-22 04:04:38 +0000 | [diff] [blame] | 215 | .TP |
| 216 | .B \-version |
| 217 | Print version information and exit. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 218 | .SH EXAMPLES |
| 219 | .LP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 220 | This example decompresses the JPEG file foo.jpg, quantizes it to |
| 221 | 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] | 222 | .IP |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 223 | .B djpeg \-colors 256 \-bmp |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 224 | .I foo.jpg |
| 225 | .B > |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 226 | .I foo.bmp |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 227 | .SH HINTS |
| 228 | To get a quick preview of an image, use the |
| 229 | .B \-grayscale |
| 230 | and/or |
| 231 | .B \-scale |
| 232 | switches. |
| 233 | .B \-grayscale \-scale 1/8 |
| 234 | is the fastest case. |
| 235 | .PP |
| 236 | Several options are available that trade off image quality to gain speed. |
| 237 | .B \-fast |
| 238 | turns on the recommended settings. |
| 239 | .PP |
| 240 | .B \-dct fast |
| 241 | and/or |
| 242 | .B \-nosmooth |
| 243 | gain speed at a small sacrifice in quality. |
| 244 | When producing a color-quantized image, |
| 245 | .B \-onepass \-dither ordered |
| 246 | is fast but much lower quality than the default behavior. |
| 247 | .B \-dither none |
| 248 | may give acceptable results in two-pass mode, but is seldom tolerable in |
| 249 | one-pass mode. |
| 250 | .PP |
| 251 | 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] | 252 | \fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most |
| 253 | machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is |
| 254 | not worth using, because its theoretical accuracy advantage is too small to be |
| 255 | significant in practice. |
Thomas G. Lane | 88aeed4 | 1992-12-10 00:00:00 +0000 | [diff] [blame] | 256 | .SH ENVIRONMENT |
| 257 | .TP |
| 258 | .B JPEGMEM |
| 259 | If this environment variable is set, its value is the default memory limit. |
| 260 | The value is specified as described for the |
| 261 | .B \-maxmemory |
| 262 | switch. |
| 263 | .B JPEGMEM |
| 264 | overrides the default value specified when the program was compiled, and |
| 265 | itself is overridden by an explicit |
| 266 | .BR \-maxmemory . |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 267 | .SH SEE ALSO |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 268 | .BR cjpeg (1), |
Thomas G. Lane | bc79e06 | 1995-08-02 00:00:00 +0000 | [diff] [blame] | 269 | .BR jpegtran (1), |
Thomas G. Lane | 36a4ccc | 1994-09-24 00:00:00 +0000 | [diff] [blame] | 270 | .BR rdjpgcom (1), |
| 271 | .BR wrjpgcom (1) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 272 | .br |
Thomas G. Lane | 4a6b730 | 1992-03-17 00:00:00 +0000 | [diff] [blame] | 273 | .BR ppm (5), |
| 274 | .BR pgm (5) |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 275 | .br |
| 276 | Wallace, Gregory K. "The JPEG Still Picture Compression Standard", |
| 277 | Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. |
| 278 | .SH AUTHOR |
| 279 | Independent JPEG Group |
DRC | cf763c0 | 2013-01-01 09:51:37 +0000 | [diff] [blame] | 280 | .PP |
| 281 | This file was modified by The libjpeg-turbo Project to include only information |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 282 | relevant to libjpeg-turbo, to wordsmith certain sections, and to describe |
| 283 | features not present in libjpeg. |
Thomas G. Lane | bd543f0 | 1991-12-13 00:00:00 +0000 | [diff] [blame] | 284 | .SH BUGS |
Thomas G. Lane | 5ead57a | 1998-03-27 00:00:00 +0000 | [diff] [blame] | 285 | To avoid the Unisys LZW patent, |
| 286 | .B djpeg |
| 287 | produces uncompressed GIF files. These are larger than they should be, but |
| 288 | are readable by standard GIF decoders. |