djpeg - decompress a JPEG file to an image file
djpeg [options] [filename]
djpeg decompresses the named JPEG file, or the standard input if no file is named, and produces an image file on the standard output. The following output file formats are currently supported:
o PGM, the PBMPLUS gray-scale format
o PPM, the PBMPLUS color format
o RLE, the Utah Raster Toolkit format
RLE is supported only if the URT library is available.
All options may be abbreviated. For example, -grayscale may be written -gray or -gr. Upper and lower case are equivalent. For example, -BMP is the same as -bmp. British spellings are also accepted. For example, -greyscale.
The following basic options are supported:
-bmp Specify that the output file is in BMP format, Windows flavor. 8-bit colormapped format is displayed if -colors or -grayscale is specified, or if the JPEG file is grayscale. Otherwise, 24-bit full-color format is displayed.
-colors N Reduce the image to at most N colors. This option reduces the number of colors used in the output image, so that the output image can be displayed on a colormapped display or stored in a colormapped file format. For example, if you have an 8-bit display, you must reduce to 256 colors or less.
You can also use -quantize to specify this option. However, -colors is the recommended option name. The -quantize option is provided only for backwards compatibility.
-fast Select the recommended processing options for fast, low-quality output. The default options are chosen for highest quality output. Currently, this is equivalent to -dct fast -nosmooth -onepass -dither ordered.
-gif Specify that the output file is in GIF format. GIF does not support more than 256 colors, so -colors 256 is assumed unless you specify a smaller number of colors.
-grayscale Create a monochrome image file even if the JPEG file is a color file. This option is useful for viewing images on monochrome displays. djpeg runs noticeably faster in this mode.
-os2 Specify that the output file is in BMP format, OS/2 1.x flavor. 8-bit colormapped format is displayed if -colors or -grayscale is specified, or if the JPEG file is grayscale. Otherwise, 24-bit full-color format is displayed.
-pnm Specify that the output file is in PBMPLUS format. PGM format is displayed if -grayscale is specified, or if the JPEG file is grayscale. Otherwise, PPM format is displayed.
-rle Specify that the output file is in RLE format. This option requires the URT library.
-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 useful if the image is larger than your screen. djpeg runs much faster when scaling down the output.
-targa Specify that the output file is in Targa format. Grayscale format is displayed if -grayscale is specified, or if the JPEG file is grayscale. Colormapped format is displayed if -colors is specified. Otherwise, 24-bit full-color format is displayed.
The following intermediate options are supported:
-dct fast Use the fast integer DCT method. This method is less accurate than the integer DCT method or the floating-point DCT method.
-dct float Use the floating-point DCT method. The float method is very slightly more accurate than the int method, but is much slower unless your machine has very fast floating-point hardware. The results of the floating-point method may vary slightly across machines, while the integer methods should give the same results everywhere.
-dct int Use the integer DCT method. This is the default method.
-dither fs Use Floyd-Steinberg dithering in color quantization. By default, Floyd-Steinberg dithering is applied when quantizing colors. This process is slow but usually produces the best results. This option has no effect unless color quantization is being done.
-dither none Do not use dithering in color quantization. No dithering is fast but is usually of poor quality. This option has no effect unless color quantization is being done.
-dither ordered Use ordered dithering in color quantization. Ordered dither is a compromise between speed and quality. Ordered dither is only available in -onepass mode. This option has no effect unless color quantization is being done.
-map file Quantize to the colors used in the specified image file. This option is useful for producing multiple files with identical color maps, or for forcing a predefined set of colors to be used. file must be a GIF or PPM file. This option overrides the -colors and -onepass options.
-maxmemory N Set the limit for the amount of memory to use in processing large images. N is specified in thousands of bytes, or in millions of bytes if "M" is specified with the number. For example, -max 4m selects 4000000 bytes. If more space is needed, temporary files are used.
-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 requires less memory, but produces a lower-quality image. The -onepass option is ignored unless you also specify the -colors N option. The one-pass method is always used for grayscale output, the two-pass method provides no improvement for such output.
-outfile name Send the output image to the named file, instead of to the standard output.
-verbose Display version information at startup, and enable debug printout. The -vv option displays more verbose output than the -v option. The -vvv option displays the most verbose output. You can also use -debug to specify the verbose option.
The following operands are supported:
filename The name of the JPEG file to be decompressed.
To get a quick preview of an image, use the -grayscale or -scale options, or a combination of both options. For example, -grayscale -scale 1/8 is the fastest case.
Several options trade image quality to gain speed. The -fast option configures the recommended settings.
The -dct fast and -nosmooth options gain speed for a small sacrifice in quality. When producing a color-quantized image, -onepass -dither ordered is fast but much lower quality than the default behavior. -dither none may give acceptable results in two-pass mode, but is seldom tolerable in one-pass mode.
If you have very fast floating point hardware, -dct float may be even faster than -dct fast. However, on most machines, -dct float is slower than -dct int. In such cases, do not use -dct float, because the theoretical accuracy advantage is too small to be significant in practice.
Example 1: Decompressing the JPEG File test.jpg, Quantizing to 256 Colors, and Saving the Output in 8-bit BMP Format as test.bmp
example% djpeg -colors 256 -bmp test.jpg > test.bmp
djpeg uses the following environment variables:
JPEGMEM The value of this environment variable, if set, is the default memory limit. The value is specified as described for the -maxmemory option. JPEGMEM overrides the default value specified when the program was compiled, and is in turn overridden by an explicit -maxmemory option.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE Availability SUNWjpg Interface stability Evolving
Wallace, Gregory K., The JPEG Still Picture Compression Standard Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
cjpeg(1), jpegtran(1), rdjpgcom(1), wrjpgcom(1)
Arithmetic coding is not supported. djpeg produces uncompressed GIF files. These large files are readable by standard GIF decoders.
This man page was originally written by the Independent JPEG Group. Updated by Breda McColgan, Sun Microsystems Inc., 2004.
|SunOS 5.11||djpeg (1)||26 Mar 2004|