blob: 9a1832204f2b7f83b1783f7cba9174bb7938888f [file] [log] [blame]
Thomas G. Lanebd543f01991-12-13 00:00:00 +00001.TH CJPEG 1 "11 December 1991"
2.SH NAME
3cjpeg \- compress an image file to a JPEG file
4.SH SYNOPSIS
5.B cjpeg
6[
7.BI \-Q " quality"
8]
9[
10.B \-oTIad
11]
12[
13.I filename
14]
15.LP
16.SH DESCRIPTION
17.LP
18.B cjpeg
19compresses the named image file, or the standard input if no file is
20named, and produces a JPEG/JFIF file on the standard output.
21The currently supported image file formats are: PPM (PBMPLUS color
22format), PGM (PBMPLUS gray-scale format), GIF, Targa, and RLE (Utah Raster
23Toolkit format). (RLE is supported only if the URT library is available.)
24.SH OPTIONS
25.TP
26.BI \-Q " quality"
27Scale quantization tables to adjust image quality. Quality is 0 (worst) to
28100 (best); default is 75. (See below for more info.)
29.TP
30.B \-o
31Perform optimization of entropy encoding parameters. Without this, default
32encoding parameters are used.
33.B \-o
34usually makes the JPEG file a little smaller, but
35.B cjpeg
36runs much slower. Image quality and speed of decompression are unaffected by
37.BR \-o .
38.TP
39.B \-T
40Input file is Targa format. Targa files that contain an "identification"
41field will not be automatically recognized by
42.BR cjpeg ;
43for such files you must specify
44.B \-T
45to force
46.B cjpeg
47to treat the input as Targa format.
48.TP
49.B \-I
50Generate noninterleaved JPEG file (not yet supported).
51.TP
52.B \-a
53Use arithmetic coding rather than Huffman coding (not currently
54supported for legal reasons).
55.TP
56.B \-d
57Enable debug printout. More
58.BR \-d 's
59give more output. Also, version information is printed at startup.
60.PP
61The
62.B \-Q
63switch lets you trade off compressed file size against quality of the
64reconstructed image: the higher the
65.B \-Q
66setting, the larger the JPEG file, and the closer the output image will be to
67the original input. Normally you want to use the lowest
68.B \-Q
69setting (smallest file) that decompresses into something visually
70indistinguishable from the original image. For this purpose the
71.B \-Q
72setting should be between 50 and 95; the default of 75 is often about right.
73If you see defects at
74.B \-Q
7575, then go up 5 or 10 counts at a time until you are happy with the output
76image. (The optimal setting will vary from one image to another.)
77.PP
78.B \-Q
79100 will generate a quantization table of all 1's, eliminating loss in the
80quantization step (but there is still information loss in subsampling, as well
81as roundoff error). This setting is mainly of interest for experimental
82purposes.
83.B \-Q
84values above about 95 are
85.B not
86recommended for normal use; the compressed file size goes up dramatically for
87hardly any gain in output image quality.
88.PP
89In the other direction,
90.B \-Q
91values below 50 will produce very small files of low image quality. Settings
92around 5 to 10 might be useful in preparing an index of a large image library,
93for example. Try
94.B \-Q
952 (or so) for some amusing Cubist effects. (Note:
96.B \-Q
97values below about 25 generate 2-byte quantization tables, which are
98considered optional in the JPEG standard.
99.B cjpeg
100emits a warning message when you give such a
101.B \-Q
102value, because some commercial JPEG programs may be unable to decode the
103resulting file.)
104.SH EXAMPLES
105.LP
106This example compresses the PPM file foo.ppm with a quality factor of
10760 and saves the output as foo.jpg:
108.IP
109.B cjpeg \-Q
110.I 60 foo.ppm
111.B >
112.I foo.jpg
113.SH SEE ALSO
114.BR djpeg (1)
115.br
116Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
117Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
118.SH AUTHOR
119Independent JPEG Group
120.SH BUGS
121Arithmetic coding and interleaved output not yet supported.
122.PP
123Not all variants of Targa file format are supported.
124.PP
125The
126.B -T
127switch is not a bug, it's a feature. (It would be a bug if the Targa format
128designers had not been clueless.)
129.PP
130Not as fast as we'd like.