DJPEG(1) DJPEG(1) NNAAMMEE djpeg - decompress a JPEG file to an image file SSYYNNOOPPSSIISS ddjjppeegg [ _o_p_t_i_o_n_s ] [ _f_i_l_e_n_a_m_e ] DDEESSCCRRIIPPTTIIOONN ddjjppeegg 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), BMP, GIF, Targa, or RLE (Utah Raster Toolkit) output format can be selected. (RLE is supported only if the URT library is available.) OOPPTTIIOONNSS All switch names may be abbreviated; for example, --ggrraayyssccaallee may be written --ggrraayy or --ggrr. Most of the "basic" switches can be abbreviated to as little as one letter. Upper and lower case are equivalent (thus --BBMMPP is the same as --bbmmpp). British spellings are also accepted (e.g., --ggrreeyyssccaallee), though for brevity these are not men- tioned below. The basic switches are: --ccoolloorrss _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. --qquuaannttiizzee _N Same as --ccoolloorrss. --ccoolloorrss is the recommended name, --qquuaannttiizzee is provided only for backwards compati- bility. --ffaasstt Select recommended processing options for fast, low quality output. (The default options are chosen for highest quality output.) Currently, this is equivalent to --ddcctt ffaasstt --nnoossmmooootthh --oonneeppaassss --ddiitthheerr oorrddeerreedd. --ggrraayyssccaallee Force gray-scale output even if JPEG file is color. Useful for viewing on monochrome displays; also, ddjjppeegg runs noticeably faster in this mode. --ssccaallee _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 22 August 1997 1 DJPEG(1) DJPEG(1) screen; also, ddjjppeegg runs much faster when scaling down the output. --bbmmpp Select BMP output format (Windows flavor). 8-bit colormapped format is emitted if --ccoolloorrss or --ggrraayyssccaallee is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color format is emitted. --ggiiff Select GIF output format. Since GIF does not sup- port more than 256 colors, --ccoolloorrss 225566 is assumed (unless you specify a smaller number of colors). --ooss22 Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format is emitted if --ccoolloorrss or --ggrraayyssccaallee is specified, or if the JPEG file is gray-scale; otherwise, 24-bit full-color format is emitted. --ppnnmm Select PBMPLUS (PPM/PGM) output format (this is the default format). PGM is emitted if the JPEG file is gray-scale or if --ggrraayyssccaallee is specified; other- wise PPM is emitted. --rrllee Select RLE output format. (Requires URT library.) --ttaarrggaa Select Targa output format. Gray-scale format is emitted if the JPEG file is gray-scale or if --ggrraayyssccaallee is specified; otherwise, colormapped format is emitted if --ccoolloorrss is specified; other- wise, 24-bit full-color format is emitted. Switches for advanced users: --ddcctt iinntt Use integer DCT method (default). --ddcctt ffaasstt Use fast integer DCT (less accurate). --ddcctt ffllooaatt Use 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. Also note that results of the floating-point method may vary slightly across machines, while the integer methods should give the same results everywhere. The fast integer method is much less accurate than the other two. --ddiitthheerr ffss Use Floyd-Steinberg dithering in color quantiza- tion. 22 August 1997 2 DJPEG(1) DJPEG(1) --ddiitthheerr oorrddeerreedd Use ordered dithering in color quantization. --ddiitthheerr nnoonnee Do not use dithering in color quantization. By default, Floyd-Steinberg dithering is applied when quantizing colors; this is slow but usually pro- duces the best results. Ordered dither is a com- promise between speed and quality; no dithering is fast but usually looks awful. Note that these switches have no effect unless color quantization is being done. Ordered dither is only available in --oonneeppaassss mode. --mmaapp _f_i_l_e Quantize to the colors used in the specified image file. This is useful for producing multiple files with identical color maps, or for forcing a prede- fined set of colors to be used. The _f_i_l_e must be a GIF or PPM file. This option overrides --ccoolloorrss and --oonneeppaassss. --nnoossmmooootthh Use a faster, lower-quality upsampling routine. --oonneeppaassss Use one-pass instead of two-pass color quantiza- tion. The one-pass method is faster and needs less memory, but it produces a lower-quality image. --oonneeppaassss is ignored unless you also say --ccoolloorrss _N. Also, the one-pass method is always used for gray- scale output (the two-pass method is no improvement then). --mmaaxxmmeemmoorryy _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, --mmaaxx 44mm selects 4000000 bytes. If more space is needed, temporary files will be used. --oouuttffiillee _n_a_m_e Send output image to the named file, not to stan- dard output. --vveerrbboossee Enable debug printout. More --vv's give more output. Also, version information is printed at startup. --ddeebbuugg Same as --vveerrbboossee. EEXXAAMMPPLLEESS This example decompresses the JPEG file foo.jpg, quantizes it to 256 colors, and saves the output in 8-bit BMP format 22 August 1997 3 DJPEG(1) DJPEG(1) in foo.bmp: ddjjppeegg --ccoolloorrss 225566 --bbmmpp _f_o_o_._j_p_g >> _f_o_o_._b_m_p HHIINNTTSS To get a quick preview of an image, use the --ggrraayyssccaallee and/or --ssccaallee switches. --ggrraayyssccaallee --ssccaallee 11//88 is the fastest case. Several options are available that trade off image quality to gain speed. --ffaasstt turns on the recommended settings. --ddcctt ffaasstt and/or --nnoossmmooootthh gain speed at a small sacrifice in quality. When producing a color-quantized image, --oonneeppaassss --ddiitthheerr oorrddeerreedd is fast but much lower quality than the default behavior. --ddiitthheerr nnoonnee may give accept- able results in two-pass mode, but is seldom tolerable in one-pass mode. If you are fortunate enough to have very fast floating point hardware, --ddcctt ffllooaatt may be even faster than --ddcctt ffaasstt. But on most machines --ddcctt ffllooaatt is slower than --ddcctt iinntt; in this case it is not worth using, because its theo- retical accuracy advantage is too small to be significant in practice. EENNVVIIRROONNMMEENNTT JJPPEEGGMMEEMM If this environment variable is set, its value is the default memory limit. The value is specified as described for the --mmaaxxmmeemmoorryy switch. JJPPEEGGMMEEMM overrides the default value specified when the pro- gram was compiled, and itself is overridden by an explicit --mmaaxxmmeemmoorryy. SSEEEE AALLSSOO ccjjppeegg(1), jjppeeggttrraann(1), rrddjjppggccoomm(1), wwrrjjppggccoomm(1) ppppmm(5), ppggmm(5) Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. AAUUTTHHOORR Independent JPEG Group BBUUGGSS Arithmetic coding is not supported for legal reasons. To avoid the Unisys LZW patent, ddjjppeegg produces uncom- pressed GIF files. These are larger than they should be, but are readable by standard GIF decoders. Still not as fast as we'd like. 22 August 1997 4