DJPEG(1) General Commands Manual 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. PBM- PLUS (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, which it isn't on most non-Unix systems.) 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 mentioned 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 compatibility. --ffaasstt Select recommended processing options for fast, low quality out- put. (The default options are chosen for highest quality out- put.) Currently, this is equivalent to --ddcctt ffaasstt --nnoossmmooootthh --oonneeppaassss --ddiitthheerr oorrddeerreedd. --ggrraayyssccaallee Force grayscale output even if JPEG file is color. Useful for viewing on monochrome displays; also, ddjjppeegg runs noticeably faster in this mode. --rrggbb Force RGB output even if JPEG file is grayscale. This is pro- vided to support applications that don't want to cope with grayscale as a separate case. --ssccaallee _M_/_N Scale the output image by a factor M/N. Currently supported scale factors are M/N with all M from 1 to 16, where N is the source DCT size, which is 8 for baseline JPEG. If the /N part is omitted, then M specifies the DCT scaled size to be applied on the given input. For baseline JPEG this is equivalent to M/8 scaling, since the source DCT size for baseline JPEG is 8. Scaling is handy if the image is larger than your 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 grayscale; otherwise, 24-bit full-color format is emitted. --ggiiff Select GIF output format (LZW compressed). Since GIF does not support more than 256 colors, --ccoolloorrss 225566 is assumed (unless you specify a smaller number of colors). If you specify --ffaasstt, the default number of colors is 216. --ggiiff00 Select GIF output format (uncompressed). Since GIF does not support more than 256 colors, --ccoolloorrss 225566 is assumed (unless you specify a smaller number of colors). If you specify --ffaasstt, the default number of colors is 216. --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 grayscale; otherwise, 24-bit full-color format is emitted. --ppnnmm Select PBMPLUS (PPM/PGM) output format (this is the default for- mat). PGM is emitted if the JPEG file is grayscale or if --ggrraayyssccaallee is specified; otherwise PPM is emitted. --rrllee Select RLE output format. (Requires URT library.) --ttaarrggaa Select Targa output format. Grayscale format is emitted if the JPEG file is grayscale 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 accu- rate than the other two. --ddiitthheerr ffss Use Floyd-Steinberg dithering in color quantization. --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 produces the best results. Ordered dither is a compromise 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 predefined 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 Don't use high-quality upsampling. --oonneeppaassss 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. --oonneeppaassss is ignored unless you also say --ccoolloorrss _N. Also, the one-pass method is always used for grayscale 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 standard output. --vveerrbboossee Enable debug printout. More --vv's give more output. Also, ver- sion 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 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 acceptable 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 theoretical accuracy advantage is too small to be signifi- cant 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 speci- fied when the program 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 28 April 2019 DJPEG(1)