1 .TH CJPEG 1 "20 March 1998"
3 cjpeg \- compress an image file to a JPEG file
16 compresses the named image file, or the standard input if no file is
17 named, and produces a JPEG/JFIF file on the standard output.
18 The currently supported input file formats are: PPM (PBMPLUS color
19 format), PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster
20 Toolkit format). (RLE is supported only if the URT library is available.)
22 All switch names may be abbreviated; for example,
28 Most of the "basic" switches can be abbreviated to as little as one letter.
29 Upper and lower case are equivalent (thus
33 British spellings are also accepted (e.g.,
35 though for brevity these are not mentioned below.
37 The basic switches are:
40 Scale quantization tables to adjust image quality. Quality is 0 (worst) to
41 100 (best); default is 75. (See below for more info.)
44 Create monochrome JPEG file from color input. Be sure to use this switch when
45 compressing a grayscale BMP file, because
47 isn't bright enough to notice whether a BMP file uses only shades of gray.
50 you'll get a smaller JPEG file that takes less time to process.
53 Perform optimization of entropy encoding parameters. Without this, default
54 encoding parameters are used.
56 usually makes the JPEG file a little smaller, but
58 runs somewhat slower and needs much more memory. Image quality and speed of
59 decompression are unaffected by
63 Create progressive JPEG file (see below).
65 .BI \-lossless " psv[,Pt]"
66 Create a lossless JPEG file using the specified predictor selection value (1-7)
67 and optional point transform.
69 lossless JPEG is not widely implemented, so many decoders will be
70 unable to view a lossless JPEG file at all.
73 Input file is Targa format. Targa files that contain an "identification"
74 field will not be automatically recognized by
76 for such files you must specify
80 treat the input as Targa format.
81 For most Targa files, you won't need this switch.
85 switch lets you trade off compressed file size against quality of the
86 reconstructed image: the higher the quality setting, the larger the JPEG file,
87 and the closer the output image will be to the original input. Normally you
88 want to use the lowest quality setting (smallest file) that decompresses into
89 something visually indistinguishable from the original image. For this
90 purpose the quality setting should be between 50 and 95; the default of 75 is
91 often about right. If you see defects at
93 75, then go up 5 or 10 counts at a time until you are happy with the output
94 image. (The optimal setting will vary from one image to another.)
97 100 will generate a quantization table of all 1's, minimizing loss in the
98 quantization step (but there is still information loss in subsampling, as well
99 as roundoff error). This setting is mainly of interest for experimental
100 purposes. Quality values above about 95 are
102 recommended for normal use; the compressed file size goes up dramatically for
103 hardly any gain in output image quality.
105 In the other direction, quality values below 50 will produce very small files
106 of low image quality. Settings around 5 to 10 might be useful in preparing an
107 index of a large image library, for example. Try
109 2 (or so) for some amusing Cubist effects. (Note: quality
110 values below about 25 generate 2-byte quantization tables, which are
111 considered optional in the JPEG standard.
113 emits a warning message when you give such a quality value, because some
114 other JPEG programs may be unable to decode the resulting file. Use
116 if you need to ensure compatibility at low quality values.)
120 switch creates a "progressive JPEG" file. In this type of JPEG file, the data
121 is stored in multiple scans of increasing quality. If the file is being
122 transmitted over a slow communications link, the decoder can use the first
123 scan to display a low-quality image very quickly, and can then improve the
124 display with each subsequent scan. The final image is exactly equivalent to a
125 standard JPEG file of the same quality setting, and the total file size is
126 about the same --- often a little smaller.
128 progressive JPEG is not yet widely implemented, so many decoders will be
129 unable to view a progressive JPEG file at all.
131 Switches for advanced users:
134 Use integer DCT method (default).
137 Use fast integer DCT (less accurate).
140 Use floating-point DCT method.
141 The float method is very slightly more accurate than the int method, but is
142 much slower unless your machine has very fast floating-point hardware. Also
143 note that results of the floating-point method may vary slightly across
144 machines, while the integer methods should give the same results everywhere.
145 The fast integer method is much less accurate than the other two.
148 Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
149 attached to the number.
151 (the default) means no restart markers.
154 Smooth the input image to eliminate dithering noise. N, ranging from 1 to
155 100, indicates the strength of smoothing. 0 (the default) means no smoothing.
158 Set limit for amount of memory to use in processing large images. Value is
159 in thousands of bytes, or millions of bytes if "M" is attached to the
162 selects 4000000 bytes. If more space is needed, temporary files will be used.
164 .BI \-outfile " name"
165 Send output image to the named file, not to standard output.
168 Enable debug printout. More
170 give more output. Also, version information is printed at startup.
178 option inserts extra markers that allow a JPEG decoder to resynchronize after
179 a transmission error. Without restart markers, any damage to a compressed
180 file will usually ruin the image from the point of the error to the end of the
181 image; with restart markers, the damage is usually confined to the portion of
182 the image up to the next restart marker. Of course, the restart markers
183 occupy extra space. We recommend
185 for images that will be transmitted across unreliable networks such as Usenet.
189 option filters the input to eliminate fine-scale noise. This is often useful
190 when converting dithered images to JPEG: a moderate smoothing factor of 10 to
191 50 gets rid of dithering patterns in the input file, resulting in a smaller
192 JPEG file and a better-looking image. Too large a smoothing factor will
193 visibly blur the image, however.
195 Switches for wizards:
198 Force baseline-compatible quantization tables to be generated. This clamps
199 quantization values to 8 bits even at low quality settings. (This switch is
200 poorly named, since it does not ensure that the output is actually baseline
201 JPEG. For example, you can use
207 .BI \-qtables " file"
208 Use the quantization tables given in the specified text file.
210 .BI \-qslots " N[,...]"
211 Select which quantization table to use for each color component.
213 .BI \-sample " HxV[,...]"
214 Set JPEG sampling factors for each color component.
217 Use the scan script given in the specified text file.
219 The "wizard" switches are intended for experimentation with JPEG. If you
220 don't know what you are doing, \fBdon't use them\fR. These switches are
221 documented further in the file wizard.doc.
224 This example compresses the PPM file foo.ppm with a quality factor of
225 60 and saves the output as foo.jpg:
232 Color GIF files are not the ideal input for JPEG; JPEG is really intended for
233 compressing full-color (24-bit) images. In particular, don't try to convert
234 cartoons, line drawings, and other images that have only a few distinct
235 colors. GIF works great on these, JPEG does not. If you want to convert a
236 GIF to JPEG, you should experiment with
241 options to get a satisfactory conversion.
243 or so is often helpful.
245 Avoid running an image through a series of JPEG compression/decompression
246 cycles. Image quality loss will accumulate; after ten or so cycles the image
247 may be noticeably worse than it was after one cycle. It's best to use a
248 lossless format while manipulating an image, then convert to JPEG format when
249 you are ready to file the image away.
255 is worth using when you are making a "final" version for posting or archiving.
256 It's also a win when you are using low quality settings to make very small
257 JPEG files; the percentage improvement is often a lot more than it is on
258 larger files. (At present,
260 mode is always selected when generating progressive JPEG files.)
264 If this environment variable is set, its value is the default memory limit.
265 The value is specified as described for the
269 overrides the default value specified when the program was compiled, and
270 itself is overridden by an explicit
281 Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
282 Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
284 Independent JPEG Group
286 Arithmetic coding is not supported for legal reasons.
288 GIF input files are no longer supported, to avoid the Unisys LZW patent.
289 Use a Unisys-licensed program if you need to read a GIF file. (Conversion
290 of GIF files to JPEG is usually a bad idea anyway.)
292 Not all variants of BMP and Targa file formats are supported.
296 switch is not a bug, it's a feature. (It would be a bug if the Targa format
297 designers had not been clueless.)
299 Still not as fast as we'd like.