.TH CJPEG 1 "28 February 1992" .SH NAME cjpeg \- compress an image file to a JPEG file .SH SYNOPSIS .B cjpeg [ .BI \-Q " quality" ] [ .B \-oTIad ] [ .BI \-m " memory" ] [ .I filename ] .LP .SH DESCRIPTION .LP .B cjpeg compresses the named image file, or the standard input if no file is named, and produces a JPEG/JFIF file on the standard output. The currently supported image file formats are: PPM (PBMPLUS color format), PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster Toolkit format). (RLE is supported only if the URT library is available.) .SH OPTIONS .TP .BI \-Q " quality" Scale quantization tables to adjust image quality. Quality is 0 (worst) to 100 (best); default is 75. (See below for more info.) .TP .B \-o Perform optimization of entropy encoding parameters. Without this, default encoding parameters are used. .B \-o usually makes the JPEG file a little smaller, but .B cjpeg runs somewhat slower and needs much more memory. Image quality and speed of decompression are unaffected by .BR \-o . .TP .B \-T Input file is Targa format. Targa files that contain an "identification" field will not be automatically recognized by .BR cjpeg ; for such files you must specify .B \-T to force .B cjpeg to treat the input as Targa format. .TP .B \-I Generate noninterleaved JPEG file (not yet supported). .TP .B \-a Use arithmetic coding rather than Huffman coding (not currently supported for legal reasons). .TP .B \-d Enable debug printout. More .BR \-d 's give more output. Also, version information is printed at startup. .TP .BI \-m " memory" 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, .B \-m 4m selects 4000000 bytes. If more space is needed, temporary files will be used. .PP The .B \-Q switch lets you trade off compressed file size against quality of the reconstructed image: the higher the .B \-Q setting, the larger the JPEG file, and the closer the output image will be to the original input. Normally you want to use the lowest .B \-Q setting (smallest file) that decompresses into something visually indistinguishable from the original image. For this purpose the .B \-Q setting should be between 50 and 95; the default of 75 is often about right. If you see defects at .B \-Q 75, then go up 5 or 10 counts at a time until you are happy with the output image. (The optimal setting will vary from one image to another.) .PP .B \-Q 100 will generate a quantization table of all 1's, eliminating loss in the quantization step (but there is still information loss in subsampling, as well as roundoff error). This setting is mainly of interest for experimental purposes. .B \-Q values above about 95 are .B not recommended for normal use; the compressed file size goes up dramatically for hardly any gain in output image quality. .PP In the other direction, .B \-Q values below 50 will produce very small files of low image quality. Settings around 5 to 10 might be useful in preparing an index of a large image library, for example. Try .B \-Q 2 (or so) for some amusing Cubist effects. (Note: .B \-Q values below about 25 generate 2-byte quantization tables, which are considered optional in the JPEG standard. .B cjpeg emits a warning message when you give such a .B \-Q value, because some commercial JPEG programs may be unable to decode the resulting file.) .SH EXAMPLES .LP This example compresses the PPM file foo.ppm with a quality factor of 60 and saves the output as foo.jpg: .IP .B cjpeg \-Q .I 60 foo.ppm .B > .I foo.jpg .SH SEE ALSO .BR djpeg (1) .br .BR ppm (5), .BR pgm (5) .br Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. .SH AUTHOR Independent JPEG Group .SH BUGS Arithmetic coding and interleaved output not yet supported. .PP Not all variants of Targa file format are supported. .PP The .B -T switch is not a bug, it's a feature. (It would be a bug if the Targa format designers had not been clueless.) .PP Not as fast as we'd like.