Penguin
Annotated edit history of cjpeg(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 CJPEG
2 !!!CJPEG
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 OPTIONS
7 EXAMPLES
8 HINTS
9 ENVIRONMENT
10 SEE ALSO
11 AUTHOR
12 BUGS
13 ----
14 !!NAME
15
16
17 cjpeg - compress an image file to a JPEG file
18 !!SYNOPSIS
19
20
21 __cjpeg__ [[ ''options'' ] [[ ''filename''
22 ]
23 !!DESCRIPTION
24
25
26 __cjpeg__ compresses the named image file, or the
27 standard input if no file is named, and produces a JPEG/JFIF
28 file on the standard output. The currently supported input
29 file formats are: PPM (PBMPLUS color format), PGM (PBMPLUS
30 gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit
31 format). (RLE is supported only if the URT library is
32 available.)
33 !!OPTIONS
34
35
36 All switch names may be abbreviated; for example,
37 __-grayscale__ may be written __-gray__ or __-gr__.
38 Most of the
39 __-BMP__ is the same as __-bmp__). British
40 spellings are also accepted (e.g., __-greyscale__),
41 though for brevity these are not mentioned
42 below.
43
44
45 The basic switches are:
46
47
48 __-quality__ ''N''
49
50
51 Scale quantization tables to adjust image quality. Quality
52 is 0 (worst) to 100 (best); default is 75. (See below for
53 more info.)
54
55
56 __-grayscale__
57
58
59 Create monochrome JPEG file from color input. Be sure to use
60 this switch when compressing a grayscale BMP file, because
61 __cjpeg__ isn't bright enough to notice whether a BMP
62 file uses only shades of gray. By saying __-grayscale__,
63 you'll get a smaller JPEG file that takes less time to
64 process.
65
66
67 __-optimize__
68
69
70 Perform optimization of entropy encoding parameters. Without
71 this, default encoding parameters are used. __-optimize__
72 usually makes the JPEG file a little smaller, but
73 __cjpeg__ runs somewhat slower and needs much more
74 memory. Image quality and speed of decompression are
75 unaffected by __-optimize__.
76
77
78 __-progressive__
79
80
81 Create progressive JPEG file (see below).
82
83
84 __-targa__
85
86
87 Input file is Targa format. Targa files that contain an
88 cjpeg__; for such files you must specify
89 __-targa__ to make __cjpeg__ treat the input as Targa
90 format. For most Targa files, you won't need this
91 switch.
92
93
94 The __-quality__ switch lets you trade off compressed
95 file size against quality of the reconstructed image: the
96 higher the quality setting, the larger the JPEG file, and
97 the closer the output image will be to the original input.
98 Normally you want to use the lowest quality setting
99 (smallest file) that decompresses into something visually
100 indistinguishable from the original image. For this purpose
101 the quality setting should be between 50 and 95; the default
102 of 75 is often about right. If you see defects at
103 __-quality__ 75, then go up 5 or 10 counts at a time
104 until you are happy with the output image. (The optimal
105 setting will vary from one image to another.)
106
107
108 __-quality__ 100 will generate a quantization table of
109 all 1's, minimizing loss in the quantization step (but there
110 is still information loss in subsampling, as well as
111 roundoff error). This setting is mainly of interest for
112 experimental purposes. Quality values above about 95 are
113 __not__ recommended for normal use; the compressed file
114 size goes up dramatically for hardly any gain in output
115 image quality.
116
117
118 In the other direction, quality values below 50 will produce
119 very small files of low image quality. Settings around 5 to
120 10 might be useful in preparing an index of a large image
121 library, for example. Try __-quality__ 2 (or so) for some
122 amusing Cubist effects. (Note: quality values below about 25
123 generate 2-byte quantization tables, which are considered
124 optional in the JPEG standard. __cjpeg__ emits a warning
125 message when you give such a quality value, because some
126 other JPEG programs may be unable to decode the resulting
127 file. Use __-baseline__ if you need to ensure
128 compatibility at low quality values.)
129
130
131 The __-progressive__ switch creates a
132 __Caution:__ progressive JPEG is not yet widely
133 implemented, so many decoders will be unable to view a
134 progressive JPEG file at all.
135
136
137 Switches for advanced users:
138
139
140 __-dct int__
141
142
143 Use integer DCT method (default).
144
145
146 __-dct fast__
147
148
149 Use fast integer DCT (less accurate).
150
151
152 __-dct float__
153
154
155 Use floating-point DCT method. The float method is very
156 slightly more accurate than the int method, but is much
157 slower unless your machine has very fast floating-point
158 hardware. Also note that results of the floating-point
159 method may vary slightly across machines, while the integer
160 methods should give the same results everywhere. The fast
161 integer method is much less accurate than the other
162 two.
163
164
165 __-restart__ ''N''
166
167
168 Emit a JPEG restart marker every N MCU rows, or every N MCU
169 blocks if
170 -restart 0__ (the default) means no restart
171 markers.
172
173
174 __-smooth__ ''N''
175
176
177 Smooth the input image to eliminate dithering noise. N,
178 ranging from 1 to 100, indicates the strength of smoothing.
179 0 (the default) means no smoothing.
180
181
182 __-maxmemory__ ''N''
183
184
185 Set limit for amount of memory to use in processing large
186 images. Value is in thousands of bytes, or millions of bytes
187 if
188 -max 4m__ selects 4000000 bytes. If more space is
189 needed, temporary files will be used.
190
191
192 __-outfile__ ''name''
193
194
195 Send output image to the named file, not to standard
196 output.
197
198
199 __-verbose__
200
201
202 Enable debug printout. More __-v__'s give more output.
203 Also, version information is printed at
204 startup.
205
206
207 __-debug__
208
209
210 Same as __-verbose__.
211
212
213 The __-restart__ option inserts extra markers that allow
214 a JPEG decoder to resynchronize after a transmission error.
215 Without restart markers, any damage to a compressed file
216 will usually ruin the image from the point of the error to
217 the end of the image; with restart markers, the damage is
218 usually confined to the portion of the image up to the next
219 restart marker. Of course, the restart markers occupy extra
220 space. We recommend __-restart 1__ for images that will
221 be transmitted across unreliable networks such as
222 Usenet.
223
224
225 The __-smooth__ option filters the input to eliminate
226 fine-scale noise. This is often useful when converting
227 dithered images to JPEG: a moderate smoothing factor of 10
228 to 50 gets rid of dithering patterns in the input file,
229 resulting in a smaller JPEG file and a better-looking image.
230 Too large a smoothing factor will visibly blur the image,
231 however.
232
233
234 Switches for wizards:
235
236
237 __-baseline__
238
239
240 Force baseline-compatible quantization tables to be
241 generated. This clamps quantization values to 8 bits even at
242 low quality settings. (This switch is poorly named, since it
243 does not ensure that the output is actually baseline JPEG.
244 For example, you can use __-baseline__ and
245 __-progressive__ together.)
246
247
248 __-qtables__ ''file''
249
250
251 Use the quantization tables given in the specified text
252 file.
253
254
255 __-qslots__ ''N[[,...]''
256
257
258 Select which quantization table to use for each color
259 component.
260
261
262 __-sample__ ''HxV[[,...]''
263
264
265 Set JPEG sampling factors for each color
266 component.
267
268
269 __-scans__ ''file''
270
271
272 Use the scan script given in the specified text
273 file.
274
275
276 The
277 don't use them__. These switches are documented
278 further in the file wizard.doc.
279 !!EXAMPLES
280
281
282 This example compresses the PPM file foo.ppm with a quality
283 factor of 60 and saves the output as foo.jpg:
284
285
286 __cjpeg -quality__ ''60 foo.ppm'' ____
287 ''foo.jpg''
288 !!HINTS
289
290
291 Color GIF files are not the ideal input for JPEG; JPEG is
292 really intended for compressing full-color (24-bit) images.
293 In particular, don't try to convert cartoons, line drawings,
294 and other images that have only a few distinct colors. GIF
295 works great on these, JPEG does not. If you want to convert
296 a GIF to JPEG, you should experiment with __cjpeg__'s
297 __-quality__ and __-smooth__ options to get a
298 satisfactory conversion. __-smooth 10__ or so is often
299 helpful.
300
301
302 Avoid running an image through a series of JPEG
303 compression/decompression cycles. Image quality loss will
304 accumulate; after ten or so cycles the image may be
305 noticeably worse than it was after one cycle. It's best to
306 use a lossless format while manipulating an image, then
307 convert to JPEG format when you are ready to file the image
308 away.
309
310
311 The __-optimize__ option to __cjpeg__ is worth using
312 when you are making a
313 __-optimize__ mode is always selected when
314 generating progressive JPEG files.)
315 !!ENVIRONMENT
316
317
318 __JPEGMEM__
319
320
321 If this environment variable is set, its value is the
322 default memory limit. The value is specified as described
323 for the __-maxmemory__ switch. __JPEGMEM__ overrides
324 the default value specified when the program was compiled,
325 and itself is overridden by an explicit
326 __-maxmemory__.
327 !!SEE ALSO
328
329
330 djpeg(1), jpegtran(1), rdjpgcom(1),
331 wrjpgcom(1)__
332 ppm__(5), pgm(5)
333 Wallace, Gregory K.
334 !!AUTHOR
335
336
337 Independent JPEG Group
338 !!BUGS
339
340
341 Arithmetic coding is not supported for legal
342 reasons.
343
344
345 GIF input files are no longer supported, to avoid the Unisys
346 LZW patent. Use a Unisys-licensed program if you need to
347 read a GIF file. (Conversion of GIF files to JPEG is usually
348 a bad idea anyway.)
349
350
351 Not all variants of BMP and Targa file formats are
352 supported.
353
354
355 The __-targa__ switch is not a bug, it's a feature. (It
356 would be a bug if the Targa format designers had not been
357 clueless.)
358
359
360 Still not as fast as we'd like.
361 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.