blob: 73d05148ab470b9709452887cfe4bdd48b5dbd71 [file] [log] [blame]
DRC9665f5e2014-11-22 04:04:38 +00001.TH DJPEG 1 "21 November 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
DRC90d6c382014-05-12 09:08:39 +000058Force grayscale output even if JPEG file is color. Useful for viewing on
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000059monochrome displays; also,
60.B djpeg
61runs noticeably faster in this mode.
62.TP
DRC90d6c382014-05-12 09:08:39 +000063.B \-rgb
64Force RGB output even if JPEG file is grayscale.
65.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000066.BI \-scale " M/N"
67Scale the output image by a factor M/N. Currently the scale factor must be
DRC27fb3fc2012-01-28 01:48:07 +000068M/8, where M is an integer between 1 and 16 inclusive, or any reduced fraction
69thereof (such as 1/2, 3/4, etc.) Scaling is handy if the image is larger than
70your screen; also,
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000071.B djpeg
72runs much faster when scaling down the output.
73.TP
74.B \-bmp
75Select BMP output format (Windows flavor). 8-bit colormapped format is
76emitted if
77.B \-colors
78or
79.B \-grayscale
DRC90d6c382014-05-12 09:08:39 +000080is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000081format is emitted.
82.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000083.B \-gif
84Select GIF output format. Since GIF does not support more than 256 colors,
85.B \-colors 256
86is assumed (unless you specify a smaller number of colors).
Thomas G. Lanebd543f01991-12-13 00:00:00 +000087.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000088.B \-os2
89Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is
90emitted if
91.B \-colors
92or
93.B \-grayscale
DRC90d6c382014-05-12 09:08:39 +000094is specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +000095format is emitted.
96.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +000097.B \-pnm
98Select PBMPLUS (PPM/PGM) output format (this is the default format).
DRC90d6c382014-05-12 09:08:39 +000099PGM is emitted if the JPEG file is grayscale or if
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000100.B \-grayscale
101is specified; otherwise PPM is emitted.
102.TP
103.B \-rle
104Select RLE output format. (Requires URT library.)
105.TP
106.B \-targa
DRC90d6c382014-05-12 09:08:39 +0000107Select Targa output format. Grayscale format is emitted if the JPEG file is
108grayscale or if
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000109.B \-grayscale
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000110is specified; otherwise, colormapped format is emitted if
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000111.B \-colors
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000112is specified; otherwise, 24-bit full-color format is emitted.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000113.PP
114Switches for advanced users:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000115.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000116.B \-dct int
117Use integer DCT method (default).
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000118.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000119.B \-dct fast
120Use fast integer DCT (less accurate).
DRC8940e6c2014-05-11 09:46:28 +0000121In libjpeg-turbo, the fast method is generally about 5-15% faster than the int
122method when using the x86/x86-64 SIMD extensions (results may vary with other
123SIMD implementations, or when using libjpeg-turbo without SIMD extensions.) If
124the JPEG image was compressed using a quality level of 85 or below, then there
125should be little or no perceptible difference between the two algorithms. When
126decompressing images that were compressed using quality levels above 85,
127however, the difference between the fast and int methods becomes more
128pronounced. With images compressed using quality=97, for instance, the fast
129method incurs generally about a 4-6 dB loss (in PSNR) relative to the int
130method, but this can be larger for some images. If you can avoid it, do not
131use the fast method when decompressing images that were compressed using
132quality levels above 97. The algorithm often degenerates for such images and
133can actually produce a more lossy output image than if the JPEG image had been
134compressed using lower quality levels.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000135.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000136.B \-dct float
137Use floating-point DCT method.
DRC05524e62014-05-11 23:14:43 +0000138The float method is mainly a legacy feature. It does not produce significantly
DRC8940e6c2014-05-11 09:46:28 +0000139more accurate results than the int method, and it is much slower. The float
140method may also give different results on different machines due to varying
141roundoff behavior, whereas the integer methods should give the same results on
142all machines.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000143.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000144.B \-dither fs
145Use Floyd-Steinberg dithering in color quantization.
146.TP
147.B \-dither ordered
148Use ordered dithering in color quantization.
149.TP
150.B \-dither none
151Do not use dithering in color quantization.
152By default, Floyd-Steinberg dithering is applied when quantizing colors; this
153is slow but usually produces the best results. Ordered dither is a compromise
154between speed and quality; no dithering is fast but usually looks awful. Note
155that these switches have no effect unless color quantization is being done.
156Ordered dither is only available in
157.B \-onepass
158mode.
159.TP
160.BI \-map " file"
161Quantize to the colors used in the specified image file. This is useful for
162producing multiple files with identical color maps, or for forcing a
163predefined set of colors to be used. The
164.I file
165must be a GIF or PPM file. This option overrides
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000166.B \-colors
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000167and
168.BR \-onepass .
169.TP
170.B \-nosmooth
171Use a faster, lower-quality upsampling routine.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000172.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000173.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000174Use one-pass instead of two-pass color quantization. The one-pass method is
175faster and needs less memory, but it produces a lower-quality image.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000176.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000177is ignored unless you also say
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000178.B \-colors
179.IR N .
DRC90d6c382014-05-12 09:08:39 +0000180Also, the one-pass method is always used for grayscale output (the two-pass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000181method is no improvement then).
182.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000183.BI \-maxmemory " N"
184Set limit for amount of memory to use in processing large images. Value is
185in thousands of bytes, or millions of bytes if "M" is attached to the
186number. For example,
187.B \-max 4m
188selects 4000000 bytes. If more space is needed, temporary files will be used.
189.TP
190.BI \-outfile " name"
191Send output image to the named file, not to standard output.
192.TP
DRCab706232013-01-18 23:42:31 +0000193.BI \-memsrc
194Load input file into memory before decompressing. This feature was implemented
195mainly as a way of testing the in-memory source manager (jpeg_mem_src().)
196.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000197.B \-verbose
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000198Enable debug printout. More
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000199.BR \-v 's
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000200give more output. Also, version information is printed at startup.
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000201.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000202.B \-debug
203Same as
204.BR \-verbose .
DRC9665f5e2014-11-22 04:04:38 +0000205.TP
206.B \-version
207Print version information and exit.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000208.SH EXAMPLES
209.LP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000210This example decompresses the JPEG file foo.jpg, quantizes it to
211256 colors, and saves the output in 8-bit BMP format in foo.bmp:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000212.IP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000213.B djpeg \-colors 256 \-bmp
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000214.I foo.jpg
215.B >
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000216.I foo.bmp
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000217.SH HINTS
218To get a quick preview of an image, use the
219.B \-grayscale
220and/or
221.B \-scale
222switches.
223.B \-grayscale \-scale 1/8
224is the fastest case.
225.PP
226Several options are available that trade off image quality to gain speed.
227.B \-fast
228turns on the recommended settings.
229.PP
230.B \-dct fast
231and/or
232.B \-nosmooth
233gain speed at a small sacrifice in quality.
234When producing a color-quantized image,
235.B \-onepass \-dither ordered
236is fast but much lower quality than the default behavior.
237.B \-dither none
238may give acceptable results in two-pass mode, but is seldom tolerable in
239one-pass mode.
240.PP
241If you are fortunate enough to have very fast floating point hardware,
Thomas G. Lanea8b67c41995-03-15 00:00:00 +0000242\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most
243machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
244not worth using, because its theoretical accuracy advantage is too small to be
245significant in practice.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000246.SH ENVIRONMENT
247.TP
248.B JPEGMEM
249If this environment variable is set, its value is the default memory limit.
250The value is specified as described for the
251.B \-maxmemory
252switch.
253.B JPEGMEM
254overrides the default value specified when the program was compiled, and
255itself is overridden by an explicit
256.BR \-maxmemory .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000257.SH SEE ALSO
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000258.BR cjpeg (1),
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000259.BR jpegtran (1),
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000260.BR rdjpgcom (1),
261.BR wrjpgcom (1)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000262.br
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000263.BR ppm (5),
264.BR pgm (5)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000265.br
266Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
267Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
268.SH AUTHOR
269Independent JPEG Group
DRCcf763c02013-01-01 09:51:37 +0000270.PP
271This file was modified by The libjpeg-turbo Project to include only information
DRCab706232013-01-18 23:42:31 +0000272relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
273features not present in libjpeg.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000274.SH BUGS
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000275To avoid the Unisys LZW patent,
276.B djpeg
277produces uncompressed GIF files. These are larger than they should be, but
278are readable by standard GIF decoders.