1DJPEG(1) General Commands Manual DJPEG(1)
2
3
4
6 djpeg - decompress a JPEG file to an image file
7
9 djpeg [ options ] [ filename ]
10
12 djpeg decompresses the named JPEG file, or the standard input if no
13 file is named, and produces an image file on the standard output. PBM‐
14 PLUS (PPM/PGM), BMP, GIF, Targa, or RLE (Utah Raster Toolkit) output
15 format can be selected. (RLE is supported only if the URT library is
16 available.)
17
19 All switch names may be abbreviated; for example, -grayscale may be
20 written -gray or -gr. Most of the "basic" switches can be abbreviated
21 to as little as one letter. Upper and lower case are equivalent (thus
22 -BMP is the same as -bmp). British spellings are also accepted (e.g.,
23 -greyscale), though for brevity these are not mentioned below.
24
25 The basic switches are:
26
27 -colors N
28 Reduce image to at most N colors. This reduces the number of
29 colors used in the output image, so that it can be displayed on
30 a colormapped display or stored in a colormapped file format.
31 For example, if you have an 8-bit display, you'd need to reduce
32 to 256 or fewer colors.
33
34 -quantize N
35 Same as -colors. -colors is the recommended name, -quantize is
36 provided only for backwards compatibility.
37
38 -fast Select recommended processing options for fast, low quality out‐
39 put. (The default options are chosen for highest quality out‐
40 put.) Currently, this is equivalent to -dct fast -nosmooth
41 -onepass -dither ordered.
42
43 -grayscale
44 Force gray-scale output even if JPEG file is color. Useful for
45 viewing on monochrome displays; also, djpeg runs noticeably
46 faster in this mode.
47
48 -scale M/N
49 Scale the output image by a factor M/N. Currently the scale
50 factor must be 1/1, 1/2, 1/4, or 1/8. Scaling is handy if the
51 image is larger than your screen; also, djpeg runs much faster
52 when scaling down the output.
53
54 -bmp Select BMP output format (Windows flavor). 8-bit colormapped
55 format is emitted if -colors or -grayscale is specified, or if
56 the JPEG file is gray-scale; otherwise, 24-bit full-color format
57 is emitted.
58
59 -gif Select GIF output format. Since GIF does not support more than
60 256 colors, -colors 256 is assumed (unless you specify a smaller
61 number of colors).
62
63 -os2 Select BMP output format (OS/2 1.x flavor). 8-bit colormapped
64 format is emitted if -colors or -grayscale is specified, or if
65 the JPEG file is gray-scale; otherwise, 24-bit full-color format
66 is emitted.
67
68 -pnm Select PBMPLUS (PPM/PGM) output format (this is the default for‐
69 mat). PGM is emitted if the JPEG file is gray-scale or if
70 -grayscale is specified; otherwise PPM is emitted.
71
72 -rle Select RLE output format. (Requires URT library.)
73
74 -targa Select Targa output format. Gray-scale format is emitted if the
75 JPEG file is gray-scale or if -grayscale is specified; other‐
76 wise, colormapped format is emitted if -colors is specified;
77 otherwise, 24-bit full-color format is emitted.
78
79 Switches for advanced users:
80
81 -dct int
82 Use integer DCT method (default).
83
84 -dct fast
85 Use fast integer DCT (less accurate).
86
87 -dct float
88 Use floating-point DCT method. The float method is very
89 slightly more accurate than the int method, but is much slower
90 unless your machine has very fast floating-point hardware. Also
91 note that results of the floating-point method may vary slightly
92 across machines, while the integer methods should give the same
93 results everywhere. The fast integer method is much less accu‐
94 rate than the other two.
95
96 -dither fs
97 Use Floyd-Steinberg dithering in color quantization.
98
99 -dither ordered
100 Use ordered dithering in color quantization.
101
102 -dither none
103 Do not use dithering in color quantization. By default, Floyd-
104 Steinberg dithering is applied when quantizing colors; this is
105 slow but usually produces the best results. Ordered dither is a
106 compromise between speed and quality; no dithering is fast but
107 usually looks awful. Note that these switches have no effect
108 unless color quantization is being done. Ordered dither is only
109 available in -onepass mode.
110
111 -map file
112 Quantize to the colors used in the specified image file. This
113 is useful for producing multiple files with identical color
114 maps, or for forcing a predefined set of colors to be used. The
115 file must be a GIF or PPM file. This option overrides -colors
116 and -onepass.
117
118 -nosmooth
119 Use a faster, lower-quality upsampling routine.
120
121 -onepass
122 Use one-pass instead of two-pass color quantization. The one-
123 pass method is faster and needs less memory, but it produces a
124 lower-quality image. -onepass is ignored unless you also say
125 -colors N. Also, the one-pass method is always used for gray-
126 scale output (the two-pass method is no improvement then).
127
128 -maxmemory N
129 Set limit for amount of memory to use in processing large
130 images. Value is in thousands of bytes, or millions of bytes if
131 "M" is attached to the number. For example, -max 4m selects
132 4000000 bytes. If more space is needed, temporary files will be
133 used.
134
135 -outfile name
136 Send output image to the named file, not to standard output.
137
138 -verbose
139 Enable debug printout. More -v's give more output. Also, ver‐
140 sion information is printed at startup.
141
142 -debug Same as -verbose.
143
145 This example decompresses the JPEG file foo.jpg, quantizes it to 256
146 colors, and saves the output in 8-bit BMP format in foo.bmp:
147
148 djpeg -colors 256 -bmp foo.jpg > foo.bmp
149
151 To get a quick preview of an image, use the -grayscale and/or -scale
152 switches. -grayscale -scale 1/8 is the fastest case.
153
154 Several options are available that trade off image quality to gain
155 speed. -fast turns on the recommended settings.
156
157 -dct fast and/or -nosmooth gain speed at a small sacrifice in quality.
158 When producing a color-quantized image, -onepass -dither ordered is
159 fast but much lower quality than the default behavior. -dither none
160 may give acceptable results in two-pass mode, but is seldom tolerable
161 in one-pass mode.
162
163 If you are fortunate enough to have very fast floating point hardware,
164 -dct float may be even faster than -dct fast. But on most machines
165 -dct float is slower than -dct int; in this case it is not worth using,
166 because its theoretical accuracy advantage is too small to be signifi‐
167 cant in practice.
168
170 JPEGMEM
171 If this environment variable is set, its value is the default
172 memory limit. The value is specified as described for the
173 -maxmemory switch. JPEGMEM overrides the default value speci‐
174 fied when the program was compiled, and itself is overridden by
175 an explicit -maxmemory.
176
178 cjpeg(1), jpegtran(1), rdjpgcom(1), wrjpgcom(1)
179 ppm(5), pgm(5)
180 Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
181 Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
182
184 Independent JPEG Group
185
187 To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files.
188 These are larger than they should be, but are readable by standard GIF
189 decoders.
190
191
192
193 11 October 2010 DJPEG(1)