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       -icc file
131              Extract ICC color management profile to the specified file.
132
133       -map file
134              Quantize to the colors used in the specified image  file.   This
135              is  useful  for  producing  multiple  files with identical color
136              maps, or for forcing a predefined set of colors to be used.  The
137              file  must  be  a GIF or PPM file. This option overrides -colors
138              and -onepass.
139
140       -nosmooth
141              Use a faster, lower-quality upsampling routine.
142
143       -onepass
144              Use one-pass instead of two-pass color quantization.   The  one-
145              pass  method  is faster and needs less memory, but it produces a
146              lower-quality image.  -onepass is ignored unless  you  also  say
147              -colors  N.   Also,  the  one-pass  method  is  always  used for
148              grayscale output (the two-pass method is no improvement then).
149
150       -maxmemory N
151              Set limit for amount  of  memory  to  use  in  processing  large
152              images.  Value is in thousands of bytes, or millions of bytes if
153              "M" is attached to the number.  For  example,  -max  4m  selects
154              4000000 bytes.  If more space is needed, an error will occur.
155
156       -outfile name
157              Send output image to the named file, not to standard output.
158
159       -memsrc
160              Load  input file into memory before decompressing.  This feature
161              was implemented mainly as a way of testing the in-memory  source
162              manager (jpeg_mem_src().)
163
164       -skip Y0,Y1
165              Decompress  all  rows  of the JPEG image except those between Y0
166              and Y1 (inclusive.)  Note that if decompression scaling is being
167              used,  then  Y0  and  Y1 are relative to the scaled image dimen‐
168              sions.
169
170       -crop WxH+X+Y
171              Decompress only a rectangular subregion of the  image,  starting
172              at point X,Y with width W and height H.  If necessary, X will be
173              shifted left to the nearest iMCU boundary, and the width will be
174              increased  accordingly.   Note  that if decompression scaling is
175              being used, then X, Y, W, and H are relative to the scaled image
176              dimensions.   Currently  this option only works with the PBMPLUS
177              (PPM/PGM), GIF, and Targa output formats.
178
179       -verbose
180              Enable debug printout.  More -v's give more output.  Also,  ver‐
181              sion information is printed at startup.
182
183       -debug Same as -verbose.
184
185       -version
186              Print version information and exit.
187

EXAMPLES

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

HINTS

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

ENVIRONMENT

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

SEE ALSO

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

AUTHOR

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

ISSUES

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