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