1DJPEG(1)                    General Commands Manual                   DJPEG(1)
2
3
4

NAME

6       djpeg - decompress a JPEG file to an image file
7

SYNOPSIS

9       djpeg [ options ] [ filename ]
10

DESCRIPTION

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

OPTIONS

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  grayscale  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       -rgb   Force RGB output even if JPEG file is grayscale.
49
50       -scale M/N
51              Scale  the  output  image  by a factor M/N.  Currently the scale
52              factor must be M/8, where M is  an  integer  between  1  and  16
53              inclusive,  or  any  reduced fraction thereof (such as 1/2, 3/4,
54              etc.)  Scaling is handy if the image is larger than your screen;
55              also, djpeg runs much faster when scaling down the output.
56
57       -bmp   Select  BMP  output  format (Windows flavor).  8-bit colormapped
58              format is emitted if -colors or -grayscale is specified,  or  if
59              the  JPEG file is grayscale; otherwise, 24-bit full-color format
60              is emitted.
61
62       -gif   Select GIF output format.  Since GIF does not support more  than
63              256 colors, -colors 256 is assumed (unless you specify a smaller
64              number of colors).
65
66       -os2   Select BMP output format (OS/2 1.x flavor).   8-bit  colormapped
67              format  is  emitted if -colors or -grayscale is specified, or if
68              the JPEG file is grayscale; otherwise, 24-bit full-color  format
69              is emitted.
70
71       -pnm   Select PBMPLUS (PPM/PGM) output format (this is the default for‐
72              mat).  PGM is emitted if  the  JPEG  file  is  grayscale  or  if
73              -grayscale is specified; otherwise PPM is emitted.
74
75       -rle   Select RLE output format.  (Requires URT library.)
76
77       -targa Select  Targa output format.  Grayscale format is emitted if the
78              JPEG file is grayscale or if -grayscale is specified; otherwise,
79              colormapped  format  is  emitted if -colors is specified; other‐
80              wise, 24-bit full-color format is emitted.
81
82       Switches for advanced users:
83
84       -dct int
85              Use integer DCT method (default).
86
87       -dct fast
88              Use fast integer DCT (less  accurate).   In  libjpeg-turbo,  the
89              fast  method is generally about 5-15% faster than the int method
90              when using the x86/x86-64 SIMD extensions (results may vary with
91              other  SIMD implementations, or when using libjpeg-turbo without
92              SIMD extensions.)  If the JPEG  image  was  compressed  using  a
93              quality  level of 85 or below, then there should be little or no
94              perceptible difference between the two algorithms.  When  decom‐
95              pressing  images that were compressed using quality levels above
96              85, however, the difference between the  fast  and  int  methods
97              becomes  more  pronounced.   With  images compressed using qual‐
98              ity=97, for instance, the fast method incurs generally  about  a
99              4-6  dB  loss (in PSNR) relative to the int method, but this can
100              be larger for some images.  If you can avoid it, do not use  the
101              fast method when decompressing images that were compressed using
102              quality levels above 97.  The algorithm  often  degenerates  for
103              such  images  and can actually produce a more lossy output image
104              than if the JPEG image had been compressed using  lower  quality
105              levels.
106
107       -dct float
108              Use  floating-point  DCT  method.   The float method is mainly a
109              legacy feature.  It does not produce significantly more accurate
110              results  than  the int method, and it is much slower.  The float
111              method may also give different results on different machines due
112              to varying roundoff behavior, whereas the integer methods should
113              give the same results on all machines.
114
115       -dither fs
116              Use Floyd-Steinberg dithering in color quantization.
117
118       -dither ordered
119              Use ordered dithering in color quantization.
120
121       -dither none
122              Do not use dithering in color quantization.  By default,  Floyd-
123              Steinberg  dithering  is applied when quantizing colors; this is
124              slow but usually produces the best results.  Ordered dither is a
125              compromise  between  speed and quality; no dithering is fast but
126              usually looks awful.  Note that these switches  have  no  effect
127              unless color quantization is being done.  Ordered dither is only
128              available in -onepass mode.
129
130       -map file
131              Quantize to the colors used in the specified image  file.   This
132              is  useful  for  producing  multiple  files with identical color
133              maps, or for forcing a predefined set of colors to be used.  The
134              file  must  be  a GIF or PPM file. This option overrides -colors
135              and -onepass.
136
137       -nosmooth
138              Use a faster, lower-quality upsampling routine.
139
140       -onepass
141              Use one-pass instead of two-pass color quantization.   The  one-
142              pass  method  is faster and needs less memory, but it produces a
143              lower-quality image.  -onepass is ignored unless  you  also  say
144              -colors  N.   Also,  the  one-pass  method  is  always  used for
145              grayscale output (the two-pass method is no improvement then).
146
147       -maxmemory N
148              Set limit for amount  of  memory  to  use  in  processing  large
149              images.  Value is in thousands of bytes, or millions of bytes if
150              "M" is attached to the number.  For  example,  -max  4m  selects
151              4000000 bytes.  If more space is needed, an error will occur.
152
153       -outfile name
154              Send output image to the named file, not to standard output.
155
156       -memsrc
157              Load  input file into memory before decompressing.  This feature
158              was implemented mainly as a way of testing the in-memory  source
159              manager (jpeg_mem_src().)
160
161       -skip Y0,Y1
162              Decompress  all  rows  of the JPEG image except those between Y0
163              and Y1 (inclusive.)  Note that if decompression scaling is being
164              used,  then  Y0  and  Y1 are relative to the scaled image dimen‐
165              sions.
166
167       -crop WxH+X+Y
168              Decompress only a rectangular subregion of the  image,  starting
169              at point X,Y with width W and height H.  If necessary, X will be
170              shifted left to the nearest iMCU boundary, and the width will be
171              increased  accordingly.   Note  that if decompression scaling is
172              being used, then X, Y, W, and H are relative to the scaled image
173              dimensions.   Currently  this option only works with the PBMPLUS
174              (PPM/PGM), GIF, and Targa output formats.
175
176       -verbose
177              Enable debug printout.  More -v's give more output.  Also,  ver‐
178              sion information is printed at startup.
179
180       -debug Same as -verbose.
181
182       -version
183              Print version information and exit.
184

EXAMPLES

186       This  example  decompresses  the JPEG file foo.jpg, quantizes it to 256
187       colors, and saves the output in 8-bit BMP format in foo.bmp:
188
189              djpeg -colors 256 -bmp foo.jpg > foo.bmp
190

HINTS

192       To get a quick preview of an image, use the  -grayscale  and/or  -scale
193       switches.  -grayscale -scale 1/8 is the fastest case.
194
195       Several  options  are  available  that  trade off image quality to gain
196       speed.  -fast turns on the recommended settings.
197
198       -dct fast and/or -nosmooth gain speed at a small sacrifice in  quality.
199       When  producing  a  color-quantized  image, -onepass -dither ordered is
200       fast but much lower quality than the default  behavior.   -dither  none
201       may  give  acceptable results in two-pass mode, but is seldom tolerable
202       in one-pass mode.
203
204       If you are fortunate enough to have very fast floating point  hardware,
205       -dct  float  may  be  even faster than -dct fast.  But on most machines
206       -dct float is slower than -dct int; in this case it is not worth using,
207       because  its theoretical accuracy advantage is too small to be signifi‐
208       cant in practice.
209

ENVIRONMENT

211       JPEGMEM
212              If this environment variable is set, its value  is  the  default
213              memory  limit.   The  value  is  specified  as described for the
214              -maxmemory switch.  JPEGMEM overrides the default  value  speci‐
215              fied  when the program was compiled, and itself is overridden by
216              an explicit -maxmemory.
217

SEE ALSO

219       cjpeg(1), jpegtran(1), rdjpgcom(1), wrjpgcom(1)
220       ppm(5), pgm(5)
221       Wallace, Gregory K.  "The JPEG  Still  Picture  Compression  Standard",
222       Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
223

AUTHOR

225       Independent JPEG Group
226
227       This  file  was  modified  by The libjpeg-turbo Project to include only
228       information relevant to libjpeg-turbo, to wordsmith  certain  sections,
229       and to describe features not present in libjpeg.
230

ISSUES

232       Support for compressed GIF output files was removed in djpeg v6b due to
233       concerns over the Unisys LZW patent.  Although this patent  expired  in
234       2006,  djpeg  still  lacks compressed GIF support, for these historical
235       reasons.  (Conversion of JPEG files to GIF is usually a bad  idea  any‐
236       way, since GIF is a 256-color format.)  The uncompressed GIF files that
237       djpeg generates are larger than they should be, but they  are  readable
238       by standard GIF decoders.
239
240
241
242                               13 November 2017                       DJPEG(1)
Impressum