DJPEG(1)

NAME
djpeg - decompress a JPEG file to an image file

SYNOPSIS
djpeg [ -colors N ] [ -grayscale ] [ -scale M/N ] [ -gif ] [ -pnm ] [ -rle ] [ -targa ] [ -blocksmooth ] [ -maxmemory N ] [ -nodither ] [ -nosmooth ] [ -onepass ] [ -verbose ] [ -debug ] [ filename ]

DESCRIPTION

djpeg decompresses the named JPEG file, or the standard input if no file is named, and produces an image file on the standard output. PBMPLUS (PPM/PGM), GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected. (RLE is supported only if the URT library is available.)

OPTIONS
All switch names may be abbreviated; for example, -grayscale may be written -gray or -gr. Most of the "basic" switches can be abbreviated to as little as one letter. Upper and lower case are equivalent (thus -GIF is the same as -gif). British spellings are also accepted (e.g., -greyscale), though for brevity these are not mentioned below.

The basic switches are:

-colors N
    Reduce image to at most N colors. This reduces the number of colors used in the output image, so that it can be displayed on a colormapped display or stored in a colormapped file format. For example, if you have an 8-bit display, you'd need to reduce to 256 or fewer colors.

-quantize N
    Same as -colors. -colors is the recommended name, -quantize is provided only for backwards compatibility.

-grayscale
    Force gray-scale output even if JPEG file is color. Useful for viewing on monochrome displays; also, djpeg runs noticeably faster in this mode.

-scale M/N
    Scale the output image by a factor M/N. Currently the scale factor must be 1/1, 1/2, 1/4, or 1/8. Scaling is handy if the image is larger than your screen; also, djpeg runs much faster when scaling down the output.

-gif
    Select GIF output format. Since GIF does not support more than 256 colors, -colors 256 is assumed (unless you specify a smaller number of colors).

-pnm
    Select PBMPLUS (PPM/PGM) output format (this is the default format). PGM is emitted if the JPEG file is gray-scale or if -grayscale is specified; otherwise PPM is emitted.

-rle
    Select RLE output format. (Requires URT library.)

-targa
    Select Targa output format. Gray-scale format is emitted if the JPEG file is gray-scale or if -grayscale is specified; otherwise, colormapped format is emitted if -colors is specified; otherwise, 24-bit full-color format is emitted.

Switches for advanced users:

-blocksmooth
    Perform cross-block smoothing. This is slow, quite memory-intensive, and only seems to improve the image at very low quality settings (-quality 10 to 20 or so). At normal quality settings it may make the image worse.

-maxmemory N
    Set limit for amount of memory to use in processing large images. Value is in thousands of bytes, or millions of bytes if "M" is attached to the number. For example, -max 4m selects 4000000 bytes. If more space is needed, temporary files will be used.

-nodither
    Do not use dithering in color quantization. By default, Floyd-Steinberg dithering is applied when quantizing colors, but on some images dithering may result in objectionable "graininess". If that happens, you can turn off dithering with -nodither.

-nosmooth
    Use a faster, lower-quality upsampling routine.

-onepass
    Use one-pass instead of two-pass color quantization. The one-pass method is faster and needs less memory, but it produces a lower-quality image. -onepass is ignored unless you also say -colors N. Also, the one-pass method is always used for gray-scale output (the two-pass method is no improvement then).

-verbose
    Enable debug printout. More -v's give more output. Also, version information is printed at startup.

-debug
    Same as -verbose.

EXAMPLES

This example decompresses the JPEG file foo.jpg, automatically quantizes to 256 colors, and saves the output in GIF format in foo.gif:

    djpeg -gif foo.jpg > foo.gif

HINTS
To get a quick preview of an image, use the -grayscale and/or -scale switches. -grayscale -scale 1/8 is the fastest option.

ENVIRONMENT

JPEGMEM
    If this environment variable is set, its value is the default memory limit. The value is specified as described for the -maxmemory switch. JPEGMEM overrides the default value specified when the program was compiled, and itself is overridden by an explicit -maxmemory.

SEE ALSO
cjpeg(1)
ppm(5), pgm(5)
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.

AUTHOR
Independent JPEG Group

BUGS
Arithmetic coding is not supported for legal reasons.

Still not as fast as we'd like.