kusano 7d535a
.TH DJPEG 1 "3 October 2009"
kusano 7d535a
.SH NAME
kusano 7d535a
djpeg \- decompress a JPEG file to an image file
kusano 7d535a
.SH SYNOPSIS
kusano 7d535a
.B djpeg
kusano 7d535a
[
kusano 7d535a
.I options
kusano 7d535a
]
kusano 7d535a
[
kusano 7d535a
.I filename
kusano 7d535a
]
kusano 7d535a
.LP
kusano 7d535a
.SH DESCRIPTION
kusano 7d535a
.LP
kusano 7d535a
.B djpeg
kusano 7d535a
decompresses the named JPEG file, or the standard input if no file is named,
kusano 7d535a
and produces an image file on the standard output.  PBMPLUS (PPM/PGM), BMP,
kusano 7d535a
GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected.
kusano 7d535a
(RLE is supported only if the URT library is available.)
kusano 7d535a
.SH OPTIONS
kusano 7d535a
All switch names may be abbreviated; for example,
kusano 7d535a
.B \-grayscale
kusano 7d535a
may be written
kusano 7d535a
.B \-gray
kusano 7d535a
or
kusano 7d535a
.BR \-gr .
kusano 7d535a
Most of the "basic" switches can be abbreviated to as little as one letter.
kusano 7d535a
Upper and lower case are equivalent (thus
kusano 7d535a
.B \-BMP
kusano 7d535a
is the same as
kusano 7d535a
.BR \-bmp ).
kusano 7d535a
British spellings are also accepted (e.g.,
kusano 7d535a
.BR \-greyscale ),
kusano 7d535a
though for brevity these are not mentioned below.
kusano 7d535a
.PP
kusano 7d535a
The basic switches are:
kusano 7d535a
.TP
kusano 7d535a
.BI \-colors " N"
kusano 7d535a
Reduce image to at most N colors.  This reduces the number of colors used in
kusano 7d535a
the output image, so that it can be displayed on a colormapped display or
kusano 7d535a
stored in a colormapped file format.  For example, if you have an 8-bit
kusano 7d535a
display, you'd need to reduce to 256 or fewer colors.
kusano 7d535a
.TP
kusano 7d535a
.BI \-quantize " N"
kusano 7d535a
Same as
kusano 7d535a
.BR \-colors .
kusano 7d535a
.B \-colors
kusano 7d535a
is the recommended name,
kusano 7d535a
.B \-quantize
kusano 7d535a
is provided only for backwards compatibility.
kusano 7d535a
.TP
kusano 7d535a
.B \-fast
kusano 7d535a
Select recommended processing options for fast, low quality output.  (The
kusano 7d535a
default options are chosen for highest quality output.)  Currently, this is
kusano 7d535a
equivalent to \fB\-dct fast \-nosmooth \-onepass \-dither ordered\fR.
kusano 7d535a
.TP
kusano 7d535a
.B \-grayscale
kusano 7d535a
Force gray-scale output even if JPEG file is color.  Useful for viewing on
kusano 7d535a
monochrome displays; also,
kusano 7d535a
.B djpeg
kusano 7d535a
runs noticeably faster in this mode.
kusano 7d535a
.TP
kusano 7d535a
.BI \-scale " M/N"
kusano 7d535a
Scale the output image by a factor M/N.  Currently supported scale factors are
kusano 7d535a
M/N with all M from 1 to 16, where N is the source DCT size, which is 8 for
kusano 7d535a
baseline JPEG.  If the /N part is omitted, then M specifies the DCT scaled
kusano 7d535a
size to be applied on the given input.  For baseline JPEG this is equivalent
kusano 7d535a
to M/8 scaling, since the source DCT size for baseline JPEG is 8.
kusano 7d535a
Scaling is handy if the image is larger than your screen; also,
kusano 7d535a
.B djpeg
kusano 7d535a
runs much faster when scaling down the output.
kusano 7d535a
.TP
kusano 7d535a
.B \-bmp
kusano 7d535a
Select BMP output format (Windows flavor).  8-bit colormapped format is
kusano 7d535a
emitted if
kusano 7d535a
.B \-colors
kusano 7d535a
or
kusano 7d535a
.B \-grayscale
kusano 7d535a
is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color
kusano 7d535a
format is emitted.
kusano 7d535a
.TP
kusano 7d535a
.B \-gif
kusano 7d535a
Select GIF output format.  Since GIF does not support more than 256 colors,
kusano 7d535a
.B \-colors 256
kusano 7d535a
is assumed (unless you specify a smaller number of colors).
kusano 7d535a
.TP
kusano 7d535a
.B \-os2
kusano 7d535a
Select BMP output format (OS/2 1.x flavor).  8-bit colormapped format is
kusano 7d535a
emitted if
kusano 7d535a
.B \-colors
kusano 7d535a
or
kusano 7d535a
.B \-grayscale
kusano 7d535a
is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color
kusano 7d535a
format is emitted.
kusano 7d535a
.TP
kusano 7d535a
.B \-pnm
kusano 7d535a
Select PBMPLUS (PPM/PGM) output format (this is the default format).
kusano 7d535a
PGM is emitted if the JPEG file is gray-scale or if
kusano 7d535a
.B \-grayscale
kusano 7d535a
is specified; otherwise PPM is emitted.
kusano 7d535a
.TP
kusano 7d535a
.B \-rle
kusano 7d535a
Select RLE output format.  (Requires URT library.)
kusano 7d535a
.TP
kusano 7d535a
.B \-targa
kusano 7d535a
Select Targa output format.  Gray-scale format is emitted if the JPEG file is
kusano 7d535a
gray-scale or if
kusano 7d535a
.B \-grayscale
kusano 7d535a
is specified; otherwise, colormapped format is emitted if
kusano 7d535a
.B \-colors
kusano 7d535a
is specified; otherwise, 24-bit full-color format is emitted.
kusano 7d535a
.PP
kusano 7d535a
Switches for advanced users:
kusano 7d535a
.TP
kusano 7d535a
.B \-dct int
kusano 7d535a
Use integer DCT method (default).
kusano 7d535a
.TP
kusano 7d535a
.B \-dct fast
kusano 7d535a
Use fast integer DCT (less accurate).
kusano 7d535a
.TP
kusano 7d535a
.B \-dct float
kusano 7d535a
Use floating-point DCT method.
kusano 7d535a
The float method is very slightly more accurate than the int method, but is
kusano 7d535a
much slower unless your machine has very fast floating-point hardware.  Also
kusano 7d535a
note that results of the floating-point method may vary slightly across
kusano 7d535a
machines, while the integer methods should give the same results everywhere.
kusano 7d535a
The fast integer method is much less accurate than the other two.
kusano 7d535a
.TP
kusano 7d535a
.B \-dither fs
kusano 7d535a
Use Floyd-Steinberg dithering in color quantization.
kusano 7d535a
.TP
kusano 7d535a
.B \-dither ordered
kusano 7d535a
Use ordered dithering in color quantization.
kusano 7d535a
.TP
kusano 7d535a
.B \-dither none
kusano 7d535a
Do not use dithering in color quantization.
kusano 7d535a
By default, Floyd-Steinberg dithering is applied when quantizing colors; this
kusano 7d535a
is slow but usually produces the best results.  Ordered dither is a compromise
kusano 7d535a
between speed and quality; no dithering is fast but usually looks awful.  Note
kusano 7d535a
that these switches have no effect unless color quantization is being done.
kusano 7d535a
Ordered dither is only available in
kusano 7d535a
.B \-onepass
kusano 7d535a
mode.
kusano 7d535a
.TP
kusano 7d535a
.BI \-map " file"
kusano 7d535a
Quantize to the colors used in the specified image file.  This is useful for
kusano 7d535a
producing multiple files with identical color maps, or for forcing a
kusano 7d535a
predefined set of colors to be used.  The
kusano 7d535a
.I file
kusano 7d535a
must be a GIF or PPM file. This option overrides
kusano 7d535a
.B \-colors
kusano 7d535a
and
kusano 7d535a
.BR \-onepass .
kusano 7d535a
.TP
kusano 7d535a
.B \-nosmooth
kusano 7d535a
Don't use high-quality upsampling.
kusano 7d535a
.TP
kusano 7d535a
.B \-onepass
kusano 7d535a
Use one-pass instead of two-pass color quantization.  The one-pass method is
kusano 7d535a
faster and needs less memory, but it produces a lower-quality image.
kusano 7d535a
.B \-onepass
kusano 7d535a
is ignored unless you also say
kusano 7d535a
.B \-colors
kusano 7d535a
.IR N .
kusano 7d535a
Also, the one-pass method is always used for gray-scale output (the two-pass
kusano 7d535a
method is no improvement then).
kusano 7d535a
.TP
kusano 7d535a
.BI \-maxmemory " N"
kusano 7d535a
Set limit for amount of memory to use in processing large images.  Value is
kusano 7d535a
in thousands of bytes, or millions of bytes if "M" is attached to the
kusano 7d535a
number.  For example,
kusano 7d535a
.B \-max 4m
kusano 7d535a
selects 4000000 bytes.  If more space is needed, temporary files will be used.
kusano 7d535a
.TP
kusano 7d535a
.BI \-outfile " name"
kusano 7d535a
Send output image to the named file, not to standard output.
kusano 7d535a
.TP
kusano 7d535a
.B \-verbose
kusano 7d535a
Enable debug printout.  More
kusano 7d535a
.BR \-v 's
kusano 7d535a
give more output.  Also, version information is printed at startup.
kusano 7d535a
.TP
kusano 7d535a
.B \-debug
kusano 7d535a
Same as
kusano 7d535a
.BR \-verbose .
kusano 7d535a
.SH EXAMPLES
kusano 7d535a
.LP
kusano 7d535a
This example decompresses the JPEG file foo.jpg, quantizes it to
kusano 7d535a
256 colors, and saves the output in 8-bit BMP format in foo.bmp:
kusano 7d535a
.IP
kusano 7d535a
.B djpeg \-colors 256 \-bmp
kusano 7d535a
.I foo.jpg
kusano 7d535a
.B >
kusano 7d535a
.I foo.bmp
kusano 7d535a
.SH HINTS
kusano 7d535a
To get a quick preview of an image, use the
kusano 7d535a
.B \-grayscale
kusano 7d535a
and/or
kusano 7d535a
.B \-scale
kusano 7d535a
switches.
kusano 7d535a
.B \-grayscale \-scale 1/8
kusano 7d535a
is the fastest case.
kusano 7d535a
.PP
kusano 7d535a
Several options are available that trade off image quality to gain speed.
kusano 7d535a
.B \-fast
kusano 7d535a
turns on the recommended settings.
kusano 7d535a
.PP
kusano 7d535a
.B \-dct fast
kusano 7d535a
and/or
kusano 7d535a
.B \-nosmooth
kusano 7d535a
gain speed at a small sacrifice in quality.
kusano 7d535a
When producing a color-quantized image,
kusano 7d535a
.B \-onepass \-dither ordered
kusano 7d535a
is fast but much lower quality than the default behavior.
kusano 7d535a
.B \-dither none
kusano 7d535a
may give acceptable results in two-pass mode, but is seldom tolerable in
kusano 7d535a
one-pass mode.
kusano 7d535a
.PP
kusano 7d535a
If you are fortunate enough to have very fast floating point hardware,
kusano 7d535a
\fB\-dct float\fR may be even faster than \fB\-dct fast\fR.  But on most
kusano 7d535a
machines \fB\-dct float\fR is slower than \fB\-dct int\fR; in this case it is
kusano 7d535a
not worth using, because its theoretical accuracy advantage is too small to be
kusano 7d535a
significant in practice.
kusano 7d535a
.SH ENVIRONMENT
kusano 7d535a
.TP
kusano 7d535a
.B JPEGMEM
kusano 7d535a
If this environment variable is set, its value is the default memory limit.
kusano 7d535a
The value is specified as described for the
kusano 7d535a
.B \-maxmemory
kusano 7d535a
switch.
kusano 7d535a
.B JPEGMEM
kusano 7d535a
overrides the default value specified when the program was compiled, and
kusano 7d535a
itself is overridden by an explicit
kusano 7d535a
.BR \-maxmemory .
kusano 7d535a
.SH SEE ALSO
kusano 7d535a
.BR cjpeg (1),
kusano 7d535a
.BR jpegtran (1),
kusano 7d535a
.BR rdjpgcom (1),
kusano 7d535a
.BR wrjpgcom (1)
kusano 7d535a
.br
kusano 7d535a
.BR ppm (5),
kusano 7d535a
.BR pgm (5)
kusano 7d535a
.br
kusano 7d535a
Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
kusano 7d535a
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
kusano 7d535a
.SH AUTHOR
kusano 7d535a
Independent JPEG Group
kusano 7d535a
.SH BUGS
kusano 7d535a
To avoid the Unisys LZW patent,
kusano 7d535a
.B djpeg
kusano 7d535a
produces uncompressed GIF files.  These are larger than they should be, but
kusano 7d535a
are readable by standard GIF decoders.