MAN page from CentOS 7 mozjpeg-master-20170714.2.x86_64.rpm


Section: User Commands (1)
Updated: 18 March 2017


djpeg - decompress a JPEG file to an image file 





djpegdecompresses 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.) 


All switch names may be abbreviated; for example,-grayscalemay be written-grayor-gr.Most of the "basic" switches can be abbreviated to as little as one letter.Upper and lower case are equivalent (thus-BMPis the same as-bmp).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 inthe output image, so that it can be displayed on a colormapped display orstored in a colormapped file format. For example, if you have an 8-bitdisplay, you'd need to reduce to 256 or fewer colors.
-quantize N
Same as-colors.-colorsis the recommended name,-quantizeis provided only for backwards compatibility.
Select recommended processing options for fast, low quality output. (Thedefault options are chosen for highest quality output.) Currently, this isequivalent to -dct fast -nosmooth -onepass -dither ordered.
Force grayscale output even if JPEG file is color. Useful for viewing onmonochrome displays; also,djpegruns noticeably faster in this mode.
Force RGB output even if JPEG file is grayscale.
-scale M/N
Scale the output image by a factor M/N. Currently the scale factor must beM/8, where M is an integer between 1 and 16 inclusive, or any reduced fractionthereof (such as 1/2, 3/4, etc.) Scaling is handy if the image is larger thanyour screen; also,djpegruns much faster when scaling down the output.
Select BMP output format (Windows flavor). 8-bit colormapped format isemitted if-colorsor-grayscaleis specified, or if the JPEG file is grayscale; otherwise, 24-bit full-colorformat is emitted.
Select GIF output format. Since GIF does not support more than 256 colors,-colors 256is assumed (unless you specify a smaller number of colors).
Select BMP output format (OS/2 1.x flavor). 8-bit colormapped format isemitted if-colorsor-grayscaleis specified, or if the JPEG file is grayscale; otherwise, 24-bit full-colorformat is emitted.
Select PBMPLUS (PPM/PGM) output format (this is the default format).PGM is emitted if the JPEG file is grayscale or if-grayscaleis specified; otherwise PPM is emitted.
Select RLE output format. (Requires URT library.)
Select Targa output format. Grayscale format is emitted if the JPEG file isgrayscale or if-grayscaleis specified; otherwise, colormapped format is emitted if-colorsis specified; otherwise, 24-bit full-color format is emitted.

Switches for advanced users:

-dct int
Use integer DCT method (default).
-dct fast
Use fast integer DCT (less accurate).In libjpeg-turbo, the fast method is generally about 5-15% faster than the intmethod when using the x86/x86-64 SIMD extensions (results may vary with otherSIMD implementations, or when using libjpeg-turbo without SIMD extensions.) Ifthe JPEG image was compressed using a quality level of 85 or below, then thereshould be little or no perceptible difference between the two algorithms. Whendecompressing images that were compressed using quality levels above 85,however, the difference between the fast and int methods becomes morepronounced. With images compressed using quality=97, for instance, the fastmethod incurs generally about a 4-6 dB loss (in PSNR) relative to the intmethod, but this can be larger for some images. If you can avoid it, do notuse the fast method when decompressing images that were compressed usingquality levels above 97. The algorithm often degenerates for such images andcan actually produce a more lossy output image than if the JPEG image had beencompressed using lower quality levels.
-dct float
Use floating-point DCT method.The float method is mainly a legacy feature. It does not produce significantlymore accurate results than the int method, and it is much slower. The floatmethod may also give different results on different machines due to varyingroundoff behavior, whereas the integer methods should give the same results onall machines.
-dither fs
Use Floyd-Steinberg dithering in color quantization.
-dither ordered
Use ordered dithering in color quantization.
-dither none
Do not use dithering in color quantization.By default, Floyd-Steinberg dithering is applied when quantizing colors; thisis slow but usually produces the best results. Ordered dither is a compromisebetween speed and quality; no dithering is fast but usually looks awful. Notethat these switches have no effect unless color quantization is being done.Ordered dither is only available in-onepassmode.
-map file
Quantize to the colors used in the specified image file. This is useful forproducing multiple files with identical color maps, or for forcing apredefined set of colors to be used. Thefilemust be a GIF or PPM file. This option overrides-colorsand-onepass.
Use a faster, lower-quality upsampling routine.
Use one-pass instead of two-pass color quantization. The one-pass method isfaster and needs less memory, but it produces a lower-quality image.-onepassis ignored unless you also say-colorsN.Also, the one-pass method is always used for grayscale output (the two-passmethod is no improvement then).
-maxmemory N
Set limit for amount of memory to use in processing large images. Value isin thousands of bytes, or millions of bytes if "M" is attached to thenumber. For example,-max 4mselects 4000000 bytes. If more space is needed, an error will occur.
-outfile name
Send output image to the named file, not to standard output.
Load input file into memory before decompressing. This feature was implementedmainly as a way of testing the in-memory source manager (jpeg_mem_src().)
-skip Y0,Y1
Decompress all rows of the JPEG image except those between Y0 and Y1(inclusive.) Note that if decompression scaling is being used, then Y0 and Y1are relative to the scaled image dimensions.
-crop WxH+X+Y
Decompress only a rectangular subregion of the image, starting at point X,Ywith width W and height H. If necessary, X will be shifted left to the nearestiMCU boundary, and the width will be increased accordingly. Note that ifdecompression scaling is being used, then X, Y, W, and H are relative to thescaled image dimensions.
Enable debug printout. More-v'sgive more output. Also, version information is printed at startup.
Same as-verbose.
Print version information and exit.


This example decompresses the JPEG file foo.jpg, quantizes it to256 colors, and saves the output in 8-bit BMP format in foo.bmp:

djpeg -colors 256 -bmpfoo.jpg>foo.bmp


To get a quick preview of an image, use the-grayscaleand/or-scaleswitches.-grayscale -scale 1/8is the fastest case.

Several options are available that trade off image quality to gain speed.-fastturns on the recommended settings.

-dct fastand/or-nosmoothgain speed at a small sacrifice in quality.When producing a color-quantized image,-onepass -dither orderedis fast but much lower quality than the default behavior.-dither nonemay give acceptable results in two-pass mode, but is seldom tolerable inone-pass mode.

If you are fortunate enough to have very fast floating point hardware,-dct float may be even faster than -dct fast. But on mostmachines -dct float is slower than -dct int; in this case it isnot worth using, because its theoretical accuracy advantage is too small to besignificant in practice. 


If this environment variable is set, its value is the default memory limit.The value is specified as described for the-maxmemoryswitch.JPEGMEMoverrides the default value specified when the program was compiled, anditself is overridden by an explicit-maxmemory.


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


Independent JPEG Group

This file was modified by The libjpeg-turbo Project to include only informationrelevant to libjpeg-turbo, to wordsmith certain sections, and to describefeatures not present in libjpeg. 


Support for compressed GIF output files was removed in djpeg v6b due toconcerns over the Unisys LZW patent. Although this patent expired in 2006,djpeg still lacks compressed GIF support, for these historical reasons.(Conversion of JPEG files to GIF is usually a bad idea anyway, since GIF is a256-color format.) The uncompressed GIF files that djpeg generates are largerthan they should be, but they are readable by standard GIF decoders.




This document was created byman2html,using the manual pages.