DJPEG(1)
๐ NAME ๐
okay bestie, this is djpeg(1) from the General Commands Manual โ she'll decompress a JPEG file to an image file. that's the whole main-character assignment, no cap. ๐
โจ SYNOPSIS โจ
djpeg [ options ] [ filename ]
๐ธ DESCRIPTION ๐ธ
djpeg decompresses the JPEG file you named โ or standard input if you didn't name one โ and produces an image file on standard output. You can select PNG, PBMPLUS (PPM/PGM), BMP, GIF, or Targa output format. slay. ๐ฆ
๐ฆ 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 -BMP is 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 the image to at most N colors [legacy feature]. This reduces the number of colors used in the output image so that it can be stored in a colormapped file format. This feature cannot be used when decompressing lossless JPEG images.-quantize Nโ same as-colors;-colorsis the recommended name.-quantizeis provided only for backward compatibility.-fastโ select recommended processing options for low-quality output [legacy feature]. (The default options are chosen for highest-quality output.) Currently, this is equivalent to-dct fast -nosmooth -onepass -dither ordered. On modern CPUs, these settings have little or no performance benefit and are retained solely for backward compatibility.-grayscaleโ force grayscale output even if the JPEG file is full-color. This feature cannot be used when decompressing full-color lossless JPEG images.-rgbโ force RGB output even if the JPEG file is grayscale. This feature cannot be used when decompressing grayscale lossless JPEG images.-scale M/Nโ scale the output image by a factorM/N. Currently the scale factor must beM/8, whereMis an integer between 1 and 16 inclusive, or any reduced fraction thereof (such as1/2,3/4, etc.) Scaling is handy if the image is larger than your screen. This feature cannot be used when decompressing lossless JPEG images.-bmpโ select BMP output format (Windows flavor). 8-bit colormapped format is emitted if-colorsor-grayscaleis specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color format is emitted. This format can only be used when decompressing 8-bit-per-sample JPEG images.-gifโ select GIF output format (LZW-compressed) [legacy feature]. Since GIF does not support more than 256 colors,-colors 256is assumed (unless you specify a smaller number of colors). If you specify-fast, the default number of colors is 216. This format can only be used when decompressing 8-bit-per-sample or 12-bit-per-sample lossy JPEG images.-gif0โ select GIF output format (uncompressed) [legacy feature]. Since GIF does not support more than 256 colors,-colors 256is assumed (unless you specify a smaller number of colors). If you specify-fast, the default number of colors is 216. This format can only be used when decompressing 8-bit-per-sample or 12-bit-per-sample lossy JPEG images.-os2โ select BMP output format (OS/2 1.x flavor) [legacy feature]. 8-bit colormapped format is emitted if-colorsor-grayscaleis specified, or if the JPEG file is grayscale; otherwise, 24-bit full-color format is emitted. This format can only be used when decompressing 8-bit-per-sample JPEG images.-pngโ select PNG output format. Grayscale format is emitted if the JPEG file is grayscale or if-grayscaleis specified; otherwise truecolor format is emitted. 16-bit-per-channel format is emitted if the output data precision is greater than 8 bits. If the JPEG file contains an ICC color management profile, then it is automatically transferred to the output image unless-noiccis specified.-pnmโ 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.-targaโ select Targa output format [legacy feature]. Grayscale format is emitted if the JPEG file is grayscale or if-grayscaleis specified; otherwise, colormapped format is emitted if-colorsis specified; otherwise, 24-bit full-color format is emitted. This format can only be used when decompressing 8-bit-per-sample JPEG images.
๐ฅ Switches for advanced users:
-precision 12โ decompress an 8-bit-per-sample lossy JPEG image to a 12-bit-per-sample output image.
The JPEG format uses 16-bit DCT coefficients and computes those coefficients relative to an 8x8 DCT block. Thus, an 8-bit-per-sample JPEG image can preserve most of the signal from an underexposed higher-data-precision source image, provided that the data precision of the source image is retained in the compressor until the forward DCT stage. (Modern digital cameras typically do that, but note that libjpeg-turbo does not. Our solution for retaining higher data precision in the compressor is simply to generate a 12-bit-per-sample JPEG image.)
It may be desirable to preserve as much of that signal as possible in the decompressor, to facilitate shadow recovery in the output image. Thus, this switch forces the decompressor to use the 12-bit-per-sample decompression pipeline even if the JPEG image has 8 bits of data precision.
-dct intโ use accurate integer DCT method (default).-dct fastโ use less accurate integer DCT method [legacy feature]. When the Independent JPEG Group's software was first released in 1991, the decompression time for a 1-megapixel JPEG image on a mainstream PC was measured in minutes. Thus, the fast integer DCT algorithm provided noticeable performance benefits. On modern CPUs running libjpeg-turbo, however, the decompression time for a 1-megapixel JPEG image is measured in milliseconds, and thus the performance benefits of the fast algorithm are much less noticeable. On modern x86/x86-64 CPUs that support AVX2 instructions, the fast and int methods have similar performance. On other types of CPUs, the fast method is generally about 5-15% faster than the int method.
If the JPEG image was compressed using a quality level of 85 or below, then there should be little or no perceptible quality difference between the two algorithms. When decompressing images that were compressed using quality levels above 85, however, the difference between the fast and int methods becomes more pronounced. With images compressed using quality=97, for instance, the fast method incurs generally about a 4-6 dB loss in PSNR relative to the int method, but this can be larger for some images. If you can avoid it, do not use the fast method when decompressing images that were compressed using quality levels above 97. The algorithm often degenerates for such images and can actually produce a more lossy output image than if the JPEG image had been compressed using lower quality levels.
-dct floatโ use floating-point DCT method [legacy feature]. The float method does not produce significantly more accurate results than the int method, and it is much slower. The float method may also give different results on different machines due to varying roundoff behavior, whereas the integer methods should give the same results on all machines.-dither fsโ use Floyd-Steinberg dithering when quantizing colors [legacy feature].-dither orderedโ use ordered dithering when quantizing colors [legacy feature].-dither noneโ do not use dithering when quantizing colors [legacy feature]. By default, Floyd-Steinberg dithering is applied when quantizing colors. This is slower but usually produces the best results. Ordered dithering is a compromise between speed and quality. No dithering is faster but usually looks awful. Note that these switches have no effect unless color quantization is being done. Ordered dithering is only available in-onepassmode.-icc fileโ extract ICC color management profile to the specified file.-noiccโ do not transfer the embedded ICC color management profile (if any) from the JPEG file to a PNG output image.-map fileโ quantize to the colors used in the specified image file [legacy feature]. This is useful for producing multiple files with identical color maps, or for forcing a predefined set of colors to be used. The file must be a GIF or PPM file. This option overrides-colorsand-onepass.-nosmoothโ use a faster, lower-quality upsampling routine.-onepassโ use one-pass instead of two-pass color quantization [legacy feature]. The one-pass method needs less memory, but it produces a lower-quality image.-onepassis ignored unless you also specify-colors N. Also, the one-pass method is always used for grayscale output. (The two-pass method has no improvement in that case.)-maxmemory Nโ set limit for amount of memory to use in processing large images. Value is in thousands of bytes, or millions of bytes ifMis attached to the number. For example,-max 4mselects4000000bytes. If more space is needed, an error will occur.-maxscans Nโ abort if the JPEG image contains more than N scans. This feature demonstrates a method by which applications can guard against denial-of-service attacks instigated by specially-crafted malformed JPEG images containing numerous scans with missing image data or image data consisting only of"EOB runs"(a feature of progressive JPEG images that allows potentially hundreds of thousands of adjoining zero-value pixels to be represented using only a few bytes.) Attempting to decompress such malformed JPEG images can cause excessive CPU activity, since the decompressor must fully process each scan (even if the scan is corrupt) before it can proceed to the next scan.-outfile nameโ send output image to the named file, not to standard output.-nooverwriteโ don't overwrite the output file if it already exists. no accidental glow-up over your fave file, bestie ๐-memsrcโ load the input file into memory before decompressing. This feature was implemented mainly as a way of testing the in-memory source manager (jpeg_mem_src().) ๐ง โจ-reportโ report decompression progress. ty for the lil updates ๐ซถ-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 Y1 are relative to the scaled image dimensions. ๐ฆ-crop WxH+X+Yโ decompress only a rectangular subregion of the image, starting at point X,Y with width W and height H. If necessary, X will be shifted left to the nearest iMCU boundary, and the width will be increased accordingly. Note that if decompression scaling is being used, then X, Y, W, and H are relative to the scaled image dimensions. Currently this option does not work with the BMP output format. ๐ญ-strictโ treat all warnings as fatal. This feature also demonstrates a method by which applications can guard against attacks instigated by specially-crafted malformed JPEG images. Enabling this option will cause the decompressor to abort if the JPEG image contains incomplete or corrupt image data. ๐จ-verboseโ enable debug printout. More-v's give more output. Also, version information is printed at startup. ๐-debugโ same as-verbose. ๐ช-versionโ print version information and exit. ๐
๐ธ EXAMPLES ๐ธ
Okay so this example decompresses the JPEG file foo.jpg and saves the output in 8-bit BMP format in foo.bmp:
djpeg -bmp foo.jpg > foo.bmp
๐ ENVIRONMENT ๐
JPEGMEMโ 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, and itself is overridden by an explicit-maxmemory. ๐พ
๐ฆ SEE ALSO ๐ฆ
cjpeg(1),jpegtran(1),rdjpgcom(1),wrjpgcom(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
This file was modified by The libjpeg-turbo Project to include only information relevant to libjpeg-turbo, to wordsmith certain sections, and to describe features not present in libjpeg. ๐
Thatโs the whole manual, bestie โ DJPEG(1), libjpeg-turbo edition, dated 24 March 2026. go forth and decompress with main character energy ๐
โจ
๐ฆ where this page comes from
- arch rolling: libjpeg-turbo 3.2.1-1 ยท BSD-3-Clause AND IJG
- nixpkgs unstable: libjpeg-turbo 3.2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms