blob: 71cbd02ce56786f9b047ca22a0a74b5f9a8bb86a [file] [log] [blame]
DRC0ef076f2016-02-19 18:32:10 -06001.TH DJPEG 1 "18 February 2016"
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
DRCe67a7e32015-06-27 08:10:31 +0000197.BI \-skip " Y0,Y1"
DRC0ef076f2016-02-19 18:32:10 -0600198Decompress all rows of the JPEG image except those between Y0 and Y1
199(inclusive.) Note that if decompression scaling is being used, then Y0 and Y1
200are relative to the scaled image dimensions.
DRCe67a7e32015-06-27 08:10:31 +0000201.TP
DRC0ef076f2016-02-19 18:32:10 -0600202.BI \-crop " WxH+X+Y"
203Decompress only a rectangular subregion of the image, starting at point X,Y
204with width W and height H. If necessary, X will be shifted left to the nearest
205iMCU boundary, and the width will be increased accordingly. Note that if
206decompression scaling is being used, then X, Y, W, and H are relative to the
DRCe67a7e32015-06-27 08:10:31 +0000207scaled image dimensions.
208.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000209.B \-verbose
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000210Enable debug printout. More
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000211.BR \-v 's
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000212give more output. Also, version information is printed at startup.
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000213.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000214.B \-debug
215Same as
216.BR \-verbose .
DRC9665f5e2014-11-22 04:04:38 +0000217.TP
218.B \-version
219Print version information and exit.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000220.SH EXAMPLES
221.LP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000222This example decompresses the JPEG file foo.jpg, quantizes it to
223256 colors, and saves the output in 8-bit BMP format in foo.bmp:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000224.IP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000225.B djpeg \-colors 256 \-bmp
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000226.I foo.jpg
227.B >
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000228.I foo.bmp
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000229.SH HINTS
230To get a quick preview of an image, use the
231.B \-grayscale
232and/or
233.B \-scale
234switches.
235.B \-grayscale \-scale 1/8
236is the fastest case.
237.PP
238Several options are available that trade off image quality to gain speed.
239.B \-fast
240turns on the recommended settings.
241.PP
242.B \-dct fast
243and/or
244.B \-nosmooth
245gain speed at a small sacrifice in quality.
246When producing a color-quantized image,
247.B \-onepass \-dither ordered
248is fast but much lower quality than the default behavior.
249.B \-dither none
250may give acceptable results in two-pass mode, but is seldom tolerable in
251one-pass mode.
252.PP
253If you are fortunate enough to have very fast floating point hardware,
Thomas G. Lanea8b67c41995-03-15 00:00:00 +0000254\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most
255machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
256not worth using, because its theoretical accuracy advantage is too small to be
257significant in practice.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000258.SH ENVIRONMENT
259.TP
260.B JPEGMEM
261If this environment variable is set, its value is the default memory limit.
262The value is specified as described for the
263.B \-maxmemory
264switch.
265.B JPEGMEM
266overrides the default value specified when the program was compiled, and
267itself is overridden by an explicit
268.BR \-maxmemory .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000269.SH SEE ALSO
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000270.BR cjpeg (1),
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000271.BR jpegtran (1),
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000272.BR rdjpgcom (1),
273.BR wrjpgcom (1)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000274.br
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000275.BR ppm (5),
276.BR pgm (5)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000277.br
278Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
279Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
280.SH AUTHOR
281Independent JPEG Group
DRCcf763c02013-01-01 09:51:37 +0000282.PP
283This file was modified by The libjpeg-turbo Project to include only information
DRCab706232013-01-18 23:42:31 +0000284relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
285features not present in libjpeg.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000286.SH BUGS
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000287To avoid the Unisys LZW patent,
288.B djpeg
289produces uncompressed GIF files. These are larger than they should be, but
290are readable by standard GIF decoders.