blob: e4204b26ed28b27a92255f7267b75a2fa9d2e369 [file] [log] [blame]
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -05001.TH DJPEG 1 "13 November 2017"
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
Leon Scroggins III3993b372018-07-16 10:43:45 -0400160.BI \-icc " file"
161Extract ICC color management profile to the specified file.
162.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000163.BI \-map " file"
164Quantize to the colors used in the specified image file. This is useful for
165producing multiple files with identical color maps, or for forcing a
166predefined set of colors to be used. The
167.I file
168must be a GIF or PPM file. This option overrides
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000169.B \-colors
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000170and
171.BR \-onepass .
172.TP
173.B \-nosmooth
174Use a faster, lower-quality upsampling routine.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000175.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000176.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000177Use one-pass instead of two-pass color quantization. The one-pass method is
178faster and needs less memory, but it produces a lower-quality image.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000179.B \-onepass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000180is ignored unless you also say
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000181.B \-colors
182.IR N .
DRC90d6c382014-05-12 09:08:39 +0000183Also, the one-pass method is always used for grayscale output (the two-pass
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000184method is no improvement then).
185.TP
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000186.BI \-maxmemory " N"
187Set limit for amount of memory to use in processing large images. Value is
188in thousands of bytes, or millions of bytes if "M" is attached to the
189number. For example,
190.B \-max 4m
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -0500191selects 4000000 bytes. If more space is needed, an error will occur.
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000192.TP
193.BI \-outfile " name"
194Send output image to the named file, not to standard output.
195.TP
DRCab706232013-01-18 23:42:31 +0000196.BI \-memsrc
197Load input file into memory before decompressing. This feature was implemented
198mainly as a way of testing the in-memory source manager (jpeg_mem_src().)
199.TP
DRCe67a7e32015-06-27 08:10:31 +0000200.BI \-skip " Y0,Y1"
DRC0ef076f2016-02-19 18:32:10 -0600201Decompress all rows of the JPEG image except those between Y0 and Y1
202(inclusive.) Note that if decompression scaling is being used, then Y0 and Y1
203are relative to the scaled image dimensions.
DRCe67a7e32015-06-27 08:10:31 +0000204.TP
DRC0ef076f2016-02-19 18:32:10 -0600205.BI \-crop " WxH+X+Y"
206Decompress only a rectangular subregion of the image, starting at point X,Y
207with width W and height H. If necessary, X will be shifted left to the nearest
208iMCU boundary, and the width will be increased accordingly. Note that if
209decompression scaling is being used, then X, Y, W, and H are relative to the
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -0500210scaled image dimensions. Currently this option only works with the
211PBMPLUS (PPM/PGM), GIF, and Targa output formats.
DRCe67a7e32015-06-27 08:10:31 +0000212.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000213.B \-verbose
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000214Enable debug printout. More
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000215.BR \-v 's
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000216give more output. Also, version information is printed at startup.
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000217.TP
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000218.B \-debug
219Same as
220.BR \-verbose .
DRC9665f5e2014-11-22 04:04:38 +0000221.TP
222.B \-version
223Print version information and exit.
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000224.SH EXAMPLES
225.LP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000226This example decompresses the JPEG file foo.jpg, quantizes it to
227256 colors, and saves the output in 8-bit BMP format in foo.bmp:
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000228.IP
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000229.B djpeg \-colors 256 \-bmp
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000230.I foo.jpg
231.B >
Thomas G. Lane5ead57a1998-03-27 00:00:00 +0000232.I foo.bmp
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000233.SH HINTS
234To get a quick preview of an image, use the
235.B \-grayscale
236and/or
237.B \-scale
238switches.
239.B \-grayscale \-scale 1/8
240is the fastest case.
241.PP
242Several options are available that trade off image quality to gain speed.
243.B \-fast
244turns on the recommended settings.
245.PP
246.B \-dct fast
247and/or
248.B \-nosmooth
249gain speed at a small sacrifice in quality.
250When producing a color-quantized image,
251.B \-onepass \-dither ordered
252is fast but much lower quality than the default behavior.
253.B \-dither none
254may give acceptable results in two-pass mode, but is seldom tolerable in
255one-pass mode.
256.PP
257If you are fortunate enough to have very fast floating point hardware,
Thomas G. Lanea8b67c41995-03-15 00:00:00 +0000258\fB\-dct float\fR may be even faster than \fB\-dct fast\fR. But on most
259machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
260not worth using, because its theoretical accuracy advantage is too small to be
261significant in practice.
Thomas G. Lane88aeed41992-12-10 00:00:00 +0000262.SH ENVIRONMENT
263.TP
264.B JPEGMEM
265If this environment variable is set, its value is the default memory limit.
266The value is specified as described for the
267.B \-maxmemory
268switch.
269.B JPEGMEM
270overrides the default value specified when the program was compiled, and
271itself is overridden by an explicit
272.BR \-maxmemory .
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000273.SH SEE ALSO
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000274.BR cjpeg (1),
Thomas G. Lanebc79e061995-08-02 00:00:00 +0000275.BR jpegtran (1),
Thomas G. Lane36a4ccc1994-09-24 00:00:00 +0000276.BR rdjpgcom (1),
277.BR wrjpgcom (1)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000278.br
Thomas G. Lane4a6b7301992-03-17 00:00:00 +0000279.BR ppm (5),
280.BR pgm (5)
Thomas G. Lanebd543f01991-12-13 00:00:00 +0000281.br
282Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
283Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
284.SH AUTHOR
285Independent JPEG Group
DRCcf763c02013-01-01 09:51:37 +0000286.PP
287This file was modified by The libjpeg-turbo Project to include only information
DRCab706232013-01-18 23:42:31 +0000288relevant to libjpeg-turbo, to wordsmith certain sections, and to describe
289features not present in libjpeg.
Alex Naidis6eb7d372016-10-16 23:10:08 +0200290.SH ISSUES
291Support for compressed GIF output files was removed in djpeg v6b due to
292concerns over the Unisys LZW patent. Although this patent expired in 2006,
293djpeg still lacks compressed GIF support, for these historical reasons.
294(Conversion of JPEG files to GIF is usually a bad idea anyway, since GIF is a
295256-color format.) The uncompressed GIF files that djpeg generates are larger
296than they should be, but they are readable by standard GIF decoders.