blob: 37646ee584d670b65253266c2800ac88175833c8 [file] [log] [blame]
DRC8940e6c2014-05-11 09:46:28 +00001.TH DJPEG 1 "11 May 2014"
Thomas G. Lanebd543f01991-12-13 00:00:00 +00002.SH NAME
3djpeg \- decompress a JPEG file to an image file
4.SH SYNOPSIS
5.B djpeg
6[
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +00007.I options
Thomas G. Lanebd543f01991-12-13 00:00:00 +00008]
9[
10.I filename
11]
12.LP
13.SH DESCRIPTION
14.LP
15.B djpeg
16decompresses the named JPEG file, or the standard input if no file is named,
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000017and produces an image file on the standard output. PBMPLUS (PPM/PGM), BMP,
18GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected.
19(RLE is supported only if the URT library is available.)
Thomas G. Lanebd543f01991-12-13 00:00:00 +000020.SH OPTIONS
Thomas G. Lane88aeed41992-12-10 00:00:00 +000021All switch names may be abbreviated; for example,
22.B \-grayscale
23may be written
24.B \-gray
25or
26.BR \-gr .
27Most of the "basic" switches can be abbreviated to as little as one letter.
28Upper and lower case are equivalent (thus
Thomas G. Lane5ead57a1998-03-27 00:00:00 +000029.B \-BMP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000030is the same as
Thomas G. Lane5ead57a1998-03-27 00:00:00 +000031.BR \-bmp ).
Thomas G. Lane88aeed41992-12-10 00:00:00 +000032British spellings are also accepted (e.g.,
33.BR \-greyscale ),
34though for brevity these are not mentioned below.
35.PP
36The basic switches are:
Thomas G. Lanebd543f01991-12-13 00:00:00 +000037.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000038.BI \-colors " N"
39Reduce image to at most N colors. This reduces the number of colors used in
40the output image, so that it can be displayed on a colormapped display or
41stored in a colormapped file format. For example, if you have an 8-bit
42display, you'd need to reduce to 256 or fewer colors.
Thomas G. Lanebd543f01991-12-13 00:00:00 +000043.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000044.BI \-quantize " N"
45Same as
46.BR \-colors .
47.B \-colors
48is the recommended name,
49.B \-quantize
50is provided only for backwards compatibility.
Thomas G. Lanebd543f01991-12-13 00:00:00 +000051.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000052.B \-fast
53Select recommended processing options for fast, low quality output. (The
54default options are chosen for highest quality output.) Currently, this is
55equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR.
56.TP
57.B \-grayscale
58Force gray-scale output even if JPEG file is color. Useful for viewing on
59monochrome displays; also,
60.B djpeg
61runs noticeably faster in this mode.
62.TP
63.BI \-scale " M/N"
64Scale the output image by a factor M/N. Currently the scale factor must be
DRC27fb3fc2012-01-28 01:48:07 +000065M/8, where M is an integer between 1 and 16 inclusive, or any reduced fraction
66thereof (such as 1/2, 3/4, etc.) Scaling is handy if the image is larger than
67your screen; also,
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000068.B djpeg
69runs much faster when scaling down the output.
70.TP
71.B \-bmp
72Select BMP output format (Windows flavor). 8-bit colormapped format is
73emitted if
74.B \-colors
75or
76.B \-grayscale
77is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color
78format is emitted.
79.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000080.B \-gif
81Select GIF output format. Since GIF does not support more than 256 colors,
82.B \-colors 256
83is assumed (unless you specify a smaller number of colors).
Thomas G. Lanebd543f01991-12-13 00:00:00 +000084.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000085.B \-os2
86Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is
87emitted if
88.B \-colors
89or
90.B \-grayscale
91is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color
92format is emitted.
93.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000094.B \-pnm
95Select PBMPLUS (PPM/PGM) output format (this is the default format).
96PGM is emitted if the JPEG file is gray-scale or if
97.B \-grayscale
98is specified; otherwise PPM is emitted.
99.TP
100.B \-rle
101Select RLE output format. (Requires URT library.)
102.TP
103.B \-targa
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000104Select Targa output format. Gray-scale format is emitted if the JPEG file is
105gray-scale or if
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000106.B \-grayscale
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000107is specified; otherwise, colormapped format is emitted if
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000108.B \-colors
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000109is specified; otherwise, 24-bit full-color format is emitted.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000110.PP
111Switches for advanced users:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000112.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000113.B \-dct int
114Use integer DCT method (default).
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000115.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000116.B \-dct fast
117Use fast integer DCT (less accurate).
DRC8940e6c2014-05-11 09:46:28 +0000118In libjpeg-turbo, the fast method is generally about 5-15% faster than the int
119method when using the x86/x86-64 SIMD extensions (results may vary with other
120SIMD implementations, or when using libjpeg-turbo without SIMD extensions.) If
121the JPEG image was compressed using a quality level of 85 or below, then there
122should be little or no perceptible difference between the two algorithms. When
123decompressing images that were compressed using quality levels above 85,
124however, the difference between the fast and int methods becomes more
125pronounced. With images compressed using quality=97, for instance, the fast
126method incurs generally about a 4-6 dB loss (in PSNR) relative to the int
127method, but this can be larger for some images. If you can avoid it, do not
128use the fast method when decompressing images that were compressed using
129quality levels above 97. The algorithm often degenerates for such images and
130can actually produce a more lossy output image than if the JPEG image had been
131compressed using lower quality levels.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000132.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000133.B \-dct float
134Use floating-point DCT method.
DRC05524e62014-05-11 23:14:43 +0000135The float method is mainly a legacy feature. It does not produce significantly
DRC8940e6c2014-05-11 09:46:28 +0000136more accurate results than the int method, and it is much slower. The float
137method may also give different results on different machines due to varying
138roundoff behavior, whereas the integer methods should give the same results on
139all machines.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000140.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000141.B \-dither fs
142Use Floyd-Steinberg dithering in color quantization.
143.TP
144.B \-dither ordered
145Use ordered dithering in color quantization.
146.TP
147.B \-dither none
148Do not use dithering in color quantization.
149By default, Floyd-Steinberg dithering is applied when quantizing colors; this
150is slow but usually produces the best results. Ordered dither is a compromise
151between speed and quality; no dithering is fast but usually looks awful. Note
152that these switches have no effect unless color quantization is being done.
153Ordered dither is only available in
154.B \-onepass
155mode.
156.TP
157.BI \-map " file"
158Quantize to the colors used in the specified image file. This is useful for
159producing multiple files with identical color maps, or for forcing a
160predefined set of colors to be used. The
161.I file
162must be a GIF or PPM file. This option overrides
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000163.B \-colors
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000164and
165.BR \-onepass .
166.TP
167.B \-nosmooth
168Use a faster, lower-quality upsampling routine.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000169.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000170.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000171Use one-pass instead of two-pass color quantization. The one-pass method is
172faster and needs less memory, but it produces a lower-quality image.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000173.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000174is ignored unless you also say
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000175.B \-colors
176.IR N .
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000177Also, the one-pass method is always used for gray-scale output (the two-pass
178method is no improvement then).
179.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000180.BI \-maxmemory " N"
181Set limit for amount of memory to use in processing large images. Value is
182in thousands of bytes, or millions of bytes if "M" is attached to the
183number. For example,
184.B \-max 4m
185selects 4000000 bytes. If more space is needed, temporary files will be used.
186.TP
187.BI \-outfile " name"
188Send output image to the named file, not to standard output.
189.TP
DRCab706232013-01-18 23:42:31 +0000190.BI \-memsrc
191Load input file into memory before decompressing. This feature was implemented
192mainly as a way of testing the in-memory source manager (jpeg_mem_src().)
193.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000194.B \-verbose
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000195Enable debug printout. More
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000196.BR \-v 's
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000197give more output. Also, version information is printed at startup.
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000198.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000199.B \-debug
200Same as
201.BR \-verbose .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000202.SH EXAMPLES
203.LP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000204This example decompresses the JPEG file foo.jpg, quantizes it to
205256 colors, and saves the output in 8-bit BMP format in foo.bmp:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000206.IP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000207.B djpeg \-colors 256 \-bmp
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000208.I foo.jpg
209.B >
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000210.I foo.bmp
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000211.SH HINTS
212To get a quick preview of an image, use the
213.B \-grayscale
214and/or
215.B \-scale
216switches.
217.B \-grayscale \-scale 1/8
218is the fastest case.
219.PP
220Several options are available that trade off image quality to gain speed.
221.B \-fast
222turns on the recommended settings.
223.PP
224.B \-dct fast
225and/or
226.B \-nosmooth
227gain speed at a small sacrifice in quality.
228When producing a color-quantized image,
229.B \-onepass \-dither ordered
230is fast but much lower quality than the default behavior.
231.B \-dither none
232may give acceptable results in two-pass mode, but is seldom tolerable in
233one-pass mode.
234.PP
235If you are fortunate enough to have very fast floating point hardware,
Thomas G. Lanea8b67c41995-03-15 00:00:00 +0000236\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most
237machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
238not worth using, because its theoretical accuracy advantage is too small to be
239significant in practice.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000240.SH ENVIRONMENT
241.TP
242.B JPEGMEM
243If this environment variable is set, its value is the default memory limit.
244The value is specified as described for the
245.B \-maxmemory
246switch.
247.B JPEGMEM
248overrides the default value specified when the program was compiled, and
249itself is overridden by an explicit
250.BR \-maxmemory .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000251.SH SEE ALSO
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000252.BR cjpeg (1),
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000253.BR jpegtran (1),
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000254.BR rdjpgcom (1),
255.BR wrjpgcom (1)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000256.br
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000257.BR ppm (5),
258.BR pgm (5)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000259.br
260Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
261Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
262.SH AUTHOR
263Independent JPEG Group
DRCcf763c02013-01-01 09:51:37 +0000264.PP
265This file was modified by The libjpeg-turbo Project to include only information
DRCab706232013-01-18 23:42:31 +0000266relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
267features not present in libjpeg.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000268.SH BUGS
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000269To avoid the Unisys LZW patent,
270.B djpeg
271produces uncompressed GIF files. These are larger than they should be, but
272are readable by standard GIF decoders.