blob: 8bb7d278f007aacc3b68d346e906450daa04977a [file] [log] [blame]
DRCab706232013-01-18 23:42:31 +00001.TH DJPEG 1 "18 January 2013"
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).
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000118.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000119.B \-dct float
120Use floating-point DCT method.
Thomas G. Lanea8b67c41995-03-15 00:00:00 +0000121The float method is very slightly more accurate than the int method, but is
122much slower unless your machine has very fast floating-point hardware. Also
123note that results of the floating-point method may vary slightly across
124machines, while the integer methods should give the same results everywhere.
125The fast integer method is much less accurate than the other two.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000126.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000127.B \-dither fs
128Use Floyd-Steinberg dithering in color quantization.
129.TP
130.B \-dither ordered
131Use ordered dithering in color quantization.
132.TP
133.B \-dither none
134Do not use dithering in color quantization.
135By default, Floyd-Steinberg dithering is applied when quantizing colors; this
136is slow but usually produces the best results. Ordered dither is a compromise
137between speed and quality; no dithering is fast but usually looks awful. Note
138that these switches have no effect unless color quantization is being done.
139Ordered dither is only available in
140.B \-onepass
141mode.
142.TP
143.BI \-map " file"
144Quantize to the colors used in the specified image file. This is useful for
145producing multiple files with identical color maps, or for forcing a
146predefined set of colors to be used. The
147.I file
148must be a GIF or PPM file. This option overrides
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000149.B \-colors
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000150and
151.BR \-onepass .
152.TP
153.B \-nosmooth
154Use a faster, lower-quality upsampling routine.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000155.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000156.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000157Use one-pass instead of two-pass color quantization. The one-pass method is
158faster and needs less memory, but it produces a lower-quality image.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000159.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000160is ignored unless you also say
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000161.B \-colors
162.IR N .
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000163Also, the one-pass method is always used for gray-scale output (the two-pass
164method is no improvement then).
165.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000166.BI \-maxmemory " N"
167Set limit for amount of memory to use in processing large images. Value is
168in thousands of bytes, or millions of bytes if "M" is attached to the
169number. For example,
170.B \-max 4m
171selects 4000000 bytes. If more space is needed, temporary files will be used.
172.TP
173.BI \-outfile " name"
174Send output image to the named file, not to standard output.
175.TP
DRCab706232013-01-18 23:42:31 +0000176.BI \-memsrc
177Load input file into memory before decompressing. This feature was implemented
178mainly as a way of testing the in-memory source manager (jpeg_mem_src().)
179.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000180.B \-verbose
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000181Enable debug printout. More
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000182.BR \-v 's
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000183give more output. Also, version information is printed at startup.
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000184.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000185.B \-debug
186Same as
187.BR \-verbose .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000188.SH EXAMPLES
189.LP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000190This example decompresses the JPEG file foo.jpg, quantizes it to
191256 colors, and saves the output in 8-bit BMP format in foo.bmp:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000192.IP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000193.B djpeg \-colors 256 \-bmp
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000194.I foo.jpg
195.B >
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000196.I foo.bmp
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000197.SH HINTS
198To get a quick preview of an image, use the
199.B \-grayscale
200and/or
201.B \-scale
202switches.
203.B \-grayscale \-scale 1/8
204is the fastest case.
205.PP
206Several options are available that trade off image quality to gain speed.
207.B \-fast
208turns on the recommended settings.
209.PP
210.B \-dct fast
211and/or
212.B \-nosmooth
213gain speed at a small sacrifice in quality.
214When producing a color-quantized image,
215.B \-onepass \-dither ordered
216is fast but much lower quality than the default behavior.
217.B \-dither none
218may give acceptable results in two-pass mode, but is seldom tolerable in
219one-pass mode.
220.PP
221If you are fortunate enough to have very fast floating point hardware,
Thomas G. Lanea8b67c41995-03-15 00:00:00 +0000222\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most
223machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
224not worth using, because its theoretical accuracy advantage is too small to be
225significant in practice.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000226.SH ENVIRONMENT
227.TP
228.B JPEGMEM
229If this environment variable is set, its value is the default memory limit.
230The value is specified as described for the
231.B \-maxmemory
232switch.
233.B JPEGMEM
234overrides the default value specified when the program was compiled, and
235itself is overridden by an explicit
236.BR \-maxmemory .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000237.SH SEE ALSO
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000238.BR cjpeg (1),
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000239.BR jpegtran (1),
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000240.BR rdjpgcom (1),
241.BR wrjpgcom (1)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000242.br
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000243.BR ppm (5),
244.BR pgm (5)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000245.br
246Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
247Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
248.SH AUTHOR
249Independent JPEG Group
DRCcf763c02013-01-01 09:51:37 +0000250.PP
251This file was modified by The libjpeg-turbo Project to include only information
DRCab706232013-01-18 23:42:31 +0000252relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
253features not present in libjpeg.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000254.SH BUGS
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000255To avoid the Unisys LZW patent,
256.B djpeg
257produces uncompressed GIF files. These are larger than they should be, but
258are readable by standard GIF decoders.