aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt1274
1 files changed, 637 insertions, 637 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt
index c91ddff..de9def7 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt
+++ b/libraries/irrlicht-1.8/source/Irrlicht/jpeglib/usage.txt
@@ -1,637 +1,637 @@
1USAGE instructions for the Independent JPEG Group's JPEG software 1USAGE instructions for the Independent JPEG Group's JPEG software
2================================================================= 2=================================================================
3 3
4This file describes usage of the JPEG conversion programs cjpeg and djpeg, 4This file describes usage of the JPEG conversion programs cjpeg and djpeg,
5as well as the utility programs jpegtran, rdjpgcom and wrjpgcom. (See 5as well as the utility programs jpegtran, rdjpgcom and wrjpgcom. (See
6the other documentation files if you wish to use the JPEG library within 6the other documentation files if you wish to use the JPEG library within
7your own programs.) 7your own programs.)
8 8
9If you are on a Unix machine you may prefer to read the Unix-style manual 9If you are on a Unix machine you may prefer to read the Unix-style manual
10pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1. 10pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1.
11 11
12 12
13INTRODUCTION 13INTRODUCTION
14 14
15These programs implement JPEG image encoding, decoding, and transcoding. 15These programs implement JPEG image encoding, decoding, and transcoding.
16JPEG (pronounced "jay-peg") is a standardized compression method for 16JPEG (pronounced "jay-peg") is a standardized compression method for
17full-color and gray-scale images. 17full-color and gray-scale images.
18 18
19 19
20GENERAL USAGE 20GENERAL USAGE
21 21
22We provide two programs, cjpeg to compress an image file into JPEG format, 22We provide two programs, cjpeg to compress an image file into JPEG format,
23and djpeg to decompress a JPEG file back into a conventional image format. 23and djpeg to decompress a JPEG file back into a conventional image format.
24 24
25On Unix-like systems, you say: 25On Unix-like systems, you say:
26 cjpeg [switches] [imagefile] >jpegfile 26 cjpeg [switches] [imagefile] >jpegfile
27or 27or
28 djpeg [switches] [jpegfile] >imagefile 28 djpeg [switches] [jpegfile] >imagefile
29The programs read the specified input file, or standard input if none is 29The programs read the specified input file, or standard input if none is
30named. They always write to standard output (with trace/error messages to 30named. They always write to standard output (with trace/error messages to
31standard error). These conventions are handy for piping images between 31standard error). These conventions are handy for piping images between
32programs. 32programs.
33 33
34On most non-Unix systems, you say: 34On most non-Unix systems, you say:
35 cjpeg [switches] imagefile jpegfile 35 cjpeg [switches] imagefile jpegfile
36or 36or
37 djpeg [switches] jpegfile imagefile 37 djpeg [switches] jpegfile imagefile
38i.e., both the input and output files are named on the command line. This 38i.e., both the input and output files are named on the command line. This
39style is a little more foolproof, and it loses no functionality if you don't 39style is a little more foolproof, and it loses no functionality if you don't
40have pipes. (You can get this style on Unix too, if you prefer, by defining 40have pipes. (You can get this style on Unix too, if you prefer, by defining
41TWO_FILE_COMMANDLINE when you compile the programs; see install.txt.) 41TWO_FILE_COMMANDLINE when you compile the programs; see install.txt.)
42 42
43You can also say: 43You can also say:
44 cjpeg [switches] -outfile jpegfile imagefile 44 cjpeg [switches] -outfile jpegfile imagefile
45or 45or
46 djpeg [switches] -outfile imagefile jpegfile 46 djpeg [switches] -outfile imagefile jpegfile
47This syntax works on all systems, so it is useful for scripts. 47This syntax works on all systems, so it is useful for scripts.
48 48
49The currently supported image file formats are: PPM (PBMPLUS color format), 49The currently supported image file formats are: PPM (PBMPLUS color format),
50PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit 50PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit
51format). (RLE is supported only if the URT library is available.) 51format). (RLE is supported only if the URT library is available.)
52cjpeg recognizes the input image format automatically, with the exception 52cjpeg recognizes the input image format automatically, with the exception
53of some Targa-format files. You have to tell djpeg which format to generate. 53of some Targa-format files. You have to tell djpeg which format to generate.
54 54
55JPEG files are in the defacto standard JFIF file format. There are other, 55JPEG files are in the defacto standard JFIF file format. There are other,
56less widely used JPEG-based file formats, but we don't support them. 56less widely used JPEG-based file formats, but we don't support them.
57 57
58All switch names may be abbreviated; for example, -grayscale may be written 58All switch names may be abbreviated; for example, -grayscale may be written
59-gray or -gr. Most of the "basic" switches can be abbreviated to as little as 59-gray or -gr. Most of the "basic" switches can be abbreviated to as little as
60one letter. Upper and lower case are equivalent (-BMP is the same as -bmp). 60one letter. Upper and lower case are equivalent (-BMP is the same as -bmp).
61British spellings are also accepted (e.g., -greyscale), though for brevity 61British spellings are also accepted (e.g., -greyscale), though for brevity
62these are not mentioned below. 62these are not mentioned below.
63 63
64 64
65CJPEG DETAILS 65CJPEG DETAILS
66 66
67The basic command line switches for cjpeg are: 67The basic command line switches for cjpeg are:
68 68
69 -quality N[,...] Scale quantization tables to adjust image quality. 69 -quality N[,...] Scale quantization tables to adjust image quality.
70 Quality is 0 (worst) to 100 (best); default is 75. 70 Quality is 0 (worst) to 100 (best); default is 75.
71 (See below for more info.) 71 (See below for more info.)
72 72
73 -grayscale Create monochrome JPEG file from color input. 73 -grayscale Create monochrome JPEG file from color input.
74 Be sure to use this switch when compressing a grayscale 74 Be sure to use this switch when compressing a grayscale
75 BMP file, because cjpeg isn't bright enough to notice 75 BMP file, because cjpeg isn't bright enough to notice
76 whether a BMP file uses only shades of gray. By 76 whether a BMP file uses only shades of gray. By
77 saying -grayscale, you'll get a smaller JPEG file that 77 saying -grayscale, you'll get a smaller JPEG file that
78 takes less time to process. 78 takes less time to process.
79 79
80 -rgb Create RGB JPEG file. 80 -rgb Create RGB JPEG file.
81 Using this switch suppresses the conversion from RGB 81 Using this switch suppresses the conversion from RGB
82 colorspace input to the default YCbCr JPEG colorspace. 82 colorspace input to the default YCbCr JPEG colorspace.
83 Use this switch in combination with the -block N 83 Use this switch in combination with the -block N
84 switch (see below) for lossless JPEG coding. 84 switch (see below) for lossless JPEG coding.
85 85
86 -optimize Perform optimization of entropy encoding parameters. 86 -optimize Perform optimization of entropy encoding parameters.
87 Without this, default encoding parameters are used. 87 Without this, default encoding parameters are used.
88 -optimize usually makes the JPEG file a little smaller, 88 -optimize usually makes the JPEG file a little smaller,
89 but cjpeg runs somewhat slower and needs much more 89 but cjpeg runs somewhat slower and needs much more
90 memory. Image quality and speed of decompression are 90 memory. Image quality and speed of decompression are
91 unaffected by -optimize. 91 unaffected by -optimize.
92 92
93 -progressive Create progressive JPEG file (see below). 93 -progressive Create progressive JPEG file (see below).
94 94
95 -scale M/N Scale the output image by a factor M/N. Currently 95 -scale M/N Scale the output image by a factor M/N. Currently
96 supported scale factors are M/N with all N from 1 to 96 supported scale factors are M/N with all N from 1 to
97 16, where M is the destination DCT size, which is 8 by 97 16, where M is the destination DCT size, which is 8 by
98 default (see -block N switch below). 98 default (see -block N switch below).
99 99
100 -targa Input file is Targa format. Targa files that contain 100 -targa Input file is Targa format. Targa files that contain
101 an "identification" field will not be automatically 101 an "identification" field will not be automatically
102 recognized by cjpeg; for such files you must specify 102 recognized by cjpeg; for such files you must specify
103 -targa to make cjpeg treat the input as Targa format. 103 -targa to make cjpeg treat the input as Targa format.
104 For most Targa files, you won't need this switch. 104 For most Targa files, you won't need this switch.
105 105
106The -quality switch lets you trade off compressed file size against quality of 106The -quality switch lets you trade off compressed file size against quality of
107the reconstructed image: the higher the quality setting, the larger the JPEG 107the reconstructed image: the higher the quality setting, the larger the JPEG
108file, and the closer the output image will be to the original input. Normally 108file, and the closer the output image will be to the original input. Normally
109you want to use the lowest quality setting (smallest file) that decompresses 109you want to use the lowest quality setting (smallest file) that decompresses
110into something visually indistinguishable from the original image. For this 110into something visually indistinguishable from the original image. For this
111purpose the quality setting should be between 50 and 95; the default of 75 is 111purpose the quality setting should be between 50 and 95; the default of 75 is
112often about right. If you see defects at -quality 75, then go up 5 or 10 112often about right. If you see defects at -quality 75, then go up 5 or 10
113counts at a time until you are happy with the output image. (The optimal 113counts at a time until you are happy with the output image. (The optimal
114setting will vary from one image to another.) 114setting will vary from one image to another.)
115 115
116-quality 100 will generate a quantization table of all 1's, minimizing loss 116-quality 100 will generate a quantization table of all 1's, minimizing loss
117in the quantization step (but there is still information loss in subsampling, 117in the quantization step (but there is still information loss in subsampling,
118as well as roundoff error). This setting is mainly of interest for 118as well as roundoff error). This setting is mainly of interest for
119experimental purposes. Quality values above about 95 are NOT recommended for 119experimental purposes. Quality values above about 95 are NOT recommended for
120normal use; the compressed file size goes up dramatically for hardly any gain 120normal use; the compressed file size goes up dramatically for hardly any gain
121in output image quality. 121in output image quality.
122 122
123In the other direction, quality values below 50 will produce very small files 123In the other direction, quality values below 50 will produce very small files
124of low image quality. Settings around 5 to 10 might be useful in preparing an 124of low image quality. Settings around 5 to 10 might be useful in preparing an
125index of a large image library, for example. Try -quality 2 (or so) for some 125index of a large image library, for example. Try -quality 2 (or so) for some
126amusing Cubist effects. (Note: quality values below about 25 generate 2-byte 126amusing Cubist effects. (Note: quality values below about 25 generate 2-byte
127quantization tables, which are considered optional in the JPEG standard. 127quantization tables, which are considered optional in the JPEG standard.
128cjpeg emits a warning message when you give such a quality value, because some 128cjpeg emits a warning message when you give such a quality value, because some
129other JPEG programs may be unable to decode the resulting file. Use -baseline 129other JPEG programs may be unable to decode the resulting file. Use -baseline
130if you need to ensure compatibility at low quality values.) 130if you need to ensure compatibility at low quality values.)
131 131
132The -quality option has been extended in IJG version 7 for support of separate 132The -quality option has been extended in IJG version 7 for support of separate
133quality settings for luminance and chrominance (or in general, for every 133quality settings for luminance and chrominance (or in general, for every
134provided quantization table slot). This feature is useful for high-quality 134provided quantization table slot). This feature is useful for high-quality
135applications which cannot accept the damage of color data by coarse 135applications which cannot accept the damage of color data by coarse
136subsampling settings. You can now easily reduce the color data amount more 136subsampling settings. You can now easily reduce the color data amount more
137smoothly with finer control without separate subsampling. The resulting file 137smoothly with finer control without separate subsampling. The resulting file
138is fully compliant with standard JPEG decoders. 138is fully compliant with standard JPEG decoders.
139Note that the -quality ratings refer to the quantization table slots, and that 139Note that the -quality ratings refer to the quantization table slots, and that
140the last value is replicated if there are more q-table slots than parameters. 140the last value is replicated if there are more q-table slots than parameters.
141The default q-table slots are 0 for luminance and 1 for chrominance with 141The default q-table slots are 0 for luminance and 1 for chrominance with
142default tables as given in the JPEG standard. This is compatible with the old 142default tables as given in the JPEG standard. This is compatible with the old
143behaviour in case that only one parameter is given, which is then used for 143behaviour in case that only one parameter is given, which is then used for
144both luminance and chrominance (slots 0 and 1). More or custom quantization 144both luminance and chrominance (slots 0 and 1). More or custom quantization
145tables can be set with -qtables and assigned to components with -qslots 145tables can be set with -qtables and assigned to components with -qslots
146parameter (see the "wizard" switches below). 146parameter (see the "wizard" switches below).
147CAUTION: You must explicitly add -sample 1x1 for efficient separate color 147CAUTION: You must explicitly add -sample 1x1 for efficient separate color
148quality selection, since the default value used by library is 2x2! 148quality selection, since the default value used by library is 2x2!
149 149
150The -progressive switch creates a "progressive JPEG" file. In this type of 150The -progressive switch creates a "progressive JPEG" file. In this type of
151JPEG file, the data is stored in multiple scans of increasing quality. If the 151JPEG file, the data is stored in multiple scans of increasing quality. If the
152file is being transmitted over a slow communications link, the decoder can use 152file is being transmitted over a slow communications link, the decoder can use
153the first scan to display a low-quality image very quickly, and can then 153the first scan to display a low-quality image very quickly, and can then
154improve the display with each subsequent scan. The final image is exactly 154improve the display with each subsequent scan. The final image is exactly
155equivalent to a standard JPEG file of the same quality setting, and the total 155equivalent to a standard JPEG file of the same quality setting, and the total
156file size is about the same --- often a little smaller. 156file size is about the same --- often a little smaller.
157 157
158Switches for advanced users: 158Switches for advanced users:
159 159
160 -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG 160 -arithmetic Use arithmetic coding. CAUTION: arithmetic coded JPEG
161 is not yet widely implemented, so many decoders will 161 is not yet widely implemented, so many decoders will
162 be unable to view an arithmetic coded JPEG file at 162 be unable to view an arithmetic coded JPEG file at
163 all. 163 all.
164 164
165 -block N Set DCT block size. All N from 1 to 16 are possible. 165 -block N Set DCT block size. All N from 1 to 16 are possible.
166 Default is 8 (baseline format). 166 Default is 8 (baseline format).
167 Larger values produce higher compression, 167 Larger values produce higher compression,
168 smaller values produce higher quality 168 smaller values produce higher quality
169 (exact DCT stage possible with 1 or 2; with the 169 (exact DCT stage possible with 1 or 2; with the
170 default quality of 75 and default Luminance qtable 170 default quality of 75 and default Luminance qtable
171 the DCT+Quantization stage is lossless for N=1). 171 the DCT+Quantization stage is lossless for N=1).
172 CAUTION: An implementation of the JPEG SmartScale 172 CAUTION: An implementation of the JPEG SmartScale
173 extension is required for this feature. SmartScale 173 extension is required for this feature. SmartScale
174 enabled JPEG is not yet widely implemented, so many 174 enabled JPEG is not yet widely implemented, so many
175 decoders will be unable to view a SmartScale extended 175 decoders will be unable to view a SmartScale extended
176 JPEG file at all. 176 JPEG file at all.
177 177
178 -dct int Use integer DCT method (default). 178 -dct int Use integer DCT method (default).
179 -dct fast Use fast integer DCT (less accurate). 179 -dct fast Use fast integer DCT (less accurate).
180 -dct float Use floating-point DCT method. 180 -dct float Use floating-point DCT method.
181 The float method is very slightly more accurate than 181 The float method is very slightly more accurate than
182 the int method, but is much slower unless your machine 182 the int method, but is much slower unless your machine
183 has very fast floating-point hardware. Also note that 183 has very fast floating-point hardware. Also note that
184 results of the floating-point method may vary slightly 184 results of the floating-point method may vary slightly
185 across machines, while the integer methods should give 185 across machines, while the integer methods should give
186 the same results everywhere. The fast integer method 186 the same results everywhere. The fast integer method
187 is much less accurate than the other two. 187 is much less accurate than the other two.
188 188
189 -nosmooth Don't use high-quality downsampling. 189 -nosmooth Don't use high-quality downsampling.
190 190
191 -restart N Emit a JPEG restart marker every N MCU rows, or every 191 -restart N Emit a JPEG restart marker every N MCU rows, or every
192 N MCU blocks if "B" is attached to the number. 192 N MCU blocks if "B" is attached to the number.
193 -restart 0 (the default) means no restart markers. 193 -restart 0 (the default) means no restart markers.
194 194
195 -smooth N Smooth the input image to eliminate dithering noise. 195 -smooth N Smooth the input image to eliminate dithering noise.
196 N, ranging from 1 to 100, indicates the strength of 196 N, ranging from 1 to 100, indicates the strength of
197 smoothing. 0 (the default) means no smoothing. 197 smoothing. 0 (the default) means no smoothing.
198 198
199 -maxmemory N Set limit for amount of memory to use in processing 199 -maxmemory N Set limit for amount of memory to use in processing
200 large images. Value is in thousands of bytes, or 200 large images. Value is in thousands of bytes, or
201 millions of bytes if "M" is attached to the number. 201 millions of bytes if "M" is attached to the number.
202 For example, -max 4m selects 4000000 bytes. If more 202 For example, -max 4m selects 4000000 bytes. If more
203 space is needed, temporary files will be used. 203 space is needed, temporary files will be used.
204 204
205 -verbose Enable debug printout. More -v's give more printout. 205 -verbose Enable debug printout. More -v's give more printout.
206 or -debug Also, version information is printed at startup. 206 or -debug Also, version information is printed at startup.
207 207
208The -restart option inserts extra markers that allow a JPEG decoder to 208The -restart option inserts extra markers that allow a JPEG decoder to
209resynchronize after a transmission error. Without restart markers, any damage 209resynchronize after a transmission error. Without restart markers, any damage
210to a compressed file will usually ruin the image from the point of the error 210to a compressed file will usually ruin the image from the point of the error
211to the end of the image; with restart markers, the damage is usually confined 211to the end of the image; with restart markers, the damage is usually confined
212to the portion of the image up to the next restart marker. Of course, the 212to the portion of the image up to the next restart marker. Of course, the
213restart markers occupy extra space. We recommend -restart 1 for images that 213restart markers occupy extra space. We recommend -restart 1 for images that
214will be transmitted across unreliable networks such as Usenet. 214will be transmitted across unreliable networks such as Usenet.
215 215
216The -smooth option filters the input to eliminate fine-scale noise. This is 216The -smooth option filters the input to eliminate fine-scale noise. This is
217often useful when converting dithered images to JPEG: a moderate smoothing 217often useful when converting dithered images to JPEG: a moderate smoothing
218factor of 10 to 50 gets rid of dithering patterns in the input file, resulting 218factor of 10 to 50 gets rid of dithering patterns in the input file, resulting
219in a smaller JPEG file and a better-looking image. Too large a smoothing 219in a smaller JPEG file and a better-looking image. Too large a smoothing
220factor will visibly blur the image, however. 220factor will visibly blur the image, however.
221 221
222Switches for wizards: 222Switches for wizards:
223 223
224 -baseline Force baseline-compatible quantization tables to be 224 -baseline Force baseline-compatible quantization tables to be
225 generated. This clamps quantization values to 8 bits 225 generated. This clamps quantization values to 8 bits
226 even at low quality settings. (This switch is poorly 226 even at low quality settings. (This switch is poorly
227 named, since it does not ensure that the output is 227 named, since it does not ensure that the output is
228 actually baseline JPEG. For example, you can use 228 actually baseline JPEG. For example, you can use
229 -baseline and -progressive together.) 229 -baseline and -progressive together.)
230 230
231 -qtables file Use the quantization tables given in the specified 231 -qtables file Use the quantization tables given in the specified
232 text file. 232 text file.
233 233
234 -qslots N[,...] Select which quantization table to use for each color 234 -qslots N[,...] Select which quantization table to use for each color
235 component. 235 component.
236 236
237 -sample HxV[,...] Set JPEG sampling factors for each color component. 237 -sample HxV[,...] Set JPEG sampling factors for each color component.
238 238
239 -scans file Use the scan script given in the specified text file. 239 -scans file Use the scan script given in the specified text file.
240 240
241The "wizard" switches are intended for experimentation with JPEG. If you 241The "wizard" switches are intended for experimentation with JPEG. If you
242don't know what you are doing, DON'T USE THEM. These switches are documented 242don't know what you are doing, DON'T USE THEM. These switches are documented
243further in the file wizard.txt. 243further in the file wizard.txt.
244 244
245 245
246DJPEG DETAILS 246DJPEG DETAILS
247 247
248The basic command line switches for djpeg are: 248The basic command line switches for djpeg are:
249 249
250 -colors N Reduce image to at most N colors. This reduces the 250 -colors N Reduce image to at most N colors. This reduces the
251 or -quantize N number of colors used in the output image, so that it 251 or -quantize N number of colors used in the output image, so that it
252 can be displayed on a colormapped display or stored in 252 can be displayed on a colormapped display or stored in
253 a colormapped file format. For example, if you have 253 a colormapped file format. For example, if you have
254 an 8-bit display, you'd need to reduce to 256 or fewer 254 an 8-bit display, you'd need to reduce to 256 or fewer
255 colors. (-colors is the recommended name, -quantize 255 colors. (-colors is the recommended name, -quantize
256 is provided only for backwards compatibility.) 256 is provided only for backwards compatibility.)
257 257
258 -fast Select recommended processing options for fast, low 258 -fast Select recommended processing options for fast, low
259 quality output. (The default options are chosen for 259 quality output. (The default options are chosen for
260 highest quality output.) Currently, this is equivalent 260 highest quality output.) Currently, this is equivalent
261 to "-dct fast -nosmooth -onepass -dither ordered". 261 to "-dct fast -nosmooth -onepass -dither ordered".
262 262
263 -grayscale Force gray-scale output even if JPEG file is color. 263 -grayscale Force gray-scale output even if JPEG file is color.
264 Useful for viewing on monochrome displays; also, 264 Useful for viewing on monochrome displays; also,
265 djpeg runs noticeably faster in this mode. 265 djpeg runs noticeably faster in this mode.
266 266
267 -scale M/N Scale the output image by a factor M/N. Currently 267 -scale M/N Scale the output image by a factor M/N. Currently
268 supported scale factors are M/N with all M from 1 to 268 supported scale factors are M/N with all M from 1 to
269 16, where N is the source DCT size, which is 8 for 269 16, where N is the source DCT size, which is 8 for
270 baseline JPEG. If the /N part is omitted, then M 270 baseline JPEG. If the /N part is omitted, then M
271 specifies the DCT scaled size to be applied on the 271 specifies the DCT scaled size to be applied on the
272 given input. For baseline JPEG this is equivalent to 272 given input. For baseline JPEG this is equivalent to
273 M/8 scaling, since the source DCT size for baseline 273 M/8 scaling, since the source DCT size for baseline
274 JPEG is 8. Scaling is handy if the image is larger 274 JPEG is 8. Scaling is handy if the image is larger
275 than your screen; also, djpeg runs much faster when 275 than your screen; also, djpeg runs much faster when
276 scaling down the output. 276 scaling down the output.
277 277
278 -bmp Select BMP output format (Windows flavor). 8-bit 278 -bmp Select BMP output format (Windows flavor). 8-bit
279 colormapped format is emitted if -colors or -grayscale 279 colormapped format is emitted if -colors or -grayscale
280 is specified, or if the JPEG file is gray-scale; 280 is specified, or if the JPEG file is gray-scale;
281 otherwise, 24-bit full-color format is emitted. 281 otherwise, 24-bit full-color format is emitted.
282 282
283 -gif Select GIF output format. Since GIF does not support 283 -gif Select GIF output format. Since GIF does not support
284 more than 256 colors, -colors 256 is assumed (unless 284 more than 256 colors, -colors 256 is assumed (unless
285 you specify a smaller number of colors). If you 285 you specify a smaller number of colors). If you
286 specify -fast, the default number of colors is 216. 286 specify -fast, the default number of colors is 216.
287 287
288 -os2 Select BMP output format (OS/2 1.x flavor). 8-bit 288 -os2 Select BMP output format (OS/2 1.x flavor). 8-bit
289 colormapped format is emitted if -colors or -grayscale 289 colormapped format is emitted if -colors or -grayscale
290 is specified, or if the JPEG file is gray-scale; 290 is specified, or if the JPEG file is gray-scale;
291 otherwise, 24-bit full-color format is emitted. 291 otherwise, 24-bit full-color format is emitted.
292 292
293 -pnm Select PBMPLUS (PPM/PGM) output format (this is the 293 -pnm Select PBMPLUS (PPM/PGM) output format (this is the
294 default format). PGM is emitted if the JPEG file is 294 default format). PGM is emitted if the JPEG file is
295 gray-scale or if -grayscale is specified; otherwise 295 gray-scale or if -grayscale is specified; otherwise
296 PPM is emitted. 296 PPM is emitted.
297 297
298 -rle Select RLE output format. (Requires URT library.) 298 -rle Select RLE output format. (Requires URT library.)
299 299
300 -targa Select Targa output format. Gray-scale format is 300 -targa Select Targa output format. Gray-scale format is
301 emitted if the JPEG file is gray-scale or if 301 emitted if the JPEG file is gray-scale or if
302 -grayscale is specified; otherwise, colormapped format 302 -grayscale is specified; otherwise, colormapped format
303 is emitted if -colors is specified; otherwise, 24-bit 303 is emitted if -colors is specified; otherwise, 24-bit
304 full-color format is emitted. 304 full-color format is emitted.
305 305
306Switches for advanced users: 306Switches for advanced users:
307 307
308 -dct int Use integer DCT method (default). 308 -dct int Use integer DCT method (default).
309 -dct fast Use fast integer DCT (less accurate). 309 -dct fast Use fast integer DCT (less accurate).
310 -dct float Use floating-point DCT method. 310 -dct float Use floating-point DCT method.
311 The float method is very slightly more accurate than 311 The float method is very slightly more accurate than
312 the int method, but is much slower unless your machine 312 the int method, but is much slower unless your machine
313 has very fast floating-point hardware. Also note that 313 has very fast floating-point hardware. Also note that
314 results of the floating-point method may vary slightly 314 results of the floating-point method may vary slightly
315 across machines, while the integer methods should give 315 across machines, while the integer methods should give
316 the same results everywhere. The fast integer method 316 the same results everywhere. The fast integer method
317 is much less accurate than the other two. 317 is much less accurate than the other two.
318 318
319 -dither fs Use Floyd-Steinberg dithering in color quantization. 319 -dither fs Use Floyd-Steinberg dithering in color quantization.
320 -dither ordered Use ordered dithering in color quantization. 320 -dither ordered Use ordered dithering in color quantization.
321 -dither none Do not use dithering in color quantization. 321 -dither none Do not use dithering in color quantization.
322 By default, Floyd-Steinberg dithering is applied when 322 By default, Floyd-Steinberg dithering is applied when
323 quantizing colors; this is slow but usually produces 323 quantizing colors; this is slow but usually produces
324 the best results. Ordered dither is a compromise 324 the best results. Ordered dither is a compromise
325 between speed and quality; no dithering is fast but 325 between speed and quality; no dithering is fast but
326 usually looks awful. Note that these switches have 326 usually looks awful. Note that these switches have
327 no effect unless color quantization is being done. 327 no effect unless color quantization is being done.
328 Ordered dither is only available in -onepass mode. 328 Ordered dither is only available in -onepass mode.
329 329
330 -map FILE Quantize to the colors used in the specified image 330 -map FILE Quantize to the colors used in the specified image
331 file. This is useful for producing multiple files 331 file. This is useful for producing multiple files
332 with identical color maps, or for forcing a predefined 332 with identical color maps, or for forcing a predefined
333 set of colors to be used. The FILE must be a GIF 333 set of colors to be used. The FILE must be a GIF
334 or PPM file. This option overrides -colors and 334 or PPM file. This option overrides -colors and
335 -onepass. 335 -onepass.
336 336
337 -nosmooth Don't use high-quality upsampling. 337 -nosmooth Don't use high-quality upsampling.
338 338
339 -onepass Use one-pass instead of two-pass color quantization. 339 -onepass Use one-pass instead of two-pass color quantization.
340 The one-pass method is faster and needs less memory, 340 The one-pass method is faster and needs less memory,
341 but it produces a lower-quality image. -onepass is 341 but it produces a lower-quality image. -onepass is
342 ignored unless you also say -colors N. Also, 342 ignored unless you also say -colors N. Also,
343 the one-pass method is always used for gray-scale 343 the one-pass method is always used for gray-scale
344 output (the two-pass method is no improvement then). 344 output (the two-pass method is no improvement then).
345 345
346 -maxmemory N Set limit for amount of memory to use in processing 346 -maxmemory N Set limit for amount of memory to use in processing
347 large images. Value is in thousands of bytes, or 347 large images. Value is in thousands of bytes, or
348 millions of bytes if "M" is attached to the number. 348 millions of bytes if "M" is attached to the number.
349 For example, -max 4m selects 4000000 bytes. If more 349 For example, -max 4m selects 4000000 bytes. If more
350 space is needed, temporary files will be used. 350 space is needed, temporary files will be used.
351 351
352 -verbose Enable debug printout. More -v's give more printout. 352 -verbose Enable debug printout. More -v's give more printout.
353 or -debug Also, version information is printed at startup. 353 or -debug Also, version information is printed at startup.
354 354
355 355
356HINTS FOR CJPEG 356HINTS FOR CJPEG
357 357
358Color GIF files are not the ideal input for JPEG; JPEG is really intended for 358Color GIF files are not the ideal input for JPEG; JPEG is really intended for
359compressing full-color (24-bit) images. In particular, don't try to convert 359compressing full-color (24-bit) images. In particular, don't try to convert
360cartoons, line drawings, and other images that have only a few distinct 360cartoons, line drawings, and other images that have only a few distinct
361colors. GIF works great on these, JPEG does not. If you want to convert a 361colors. GIF works great on these, JPEG does not. If you want to convert a
362GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options 362GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options
363to get a satisfactory conversion. -smooth 10 or so is often helpful. 363to get a satisfactory conversion. -smooth 10 or so is often helpful.
364 364
365Avoid running an image through a series of JPEG compression/decompression 365Avoid running an image through a series of JPEG compression/decompression
366cycles. Image quality loss will accumulate; after ten or so cycles the image 366cycles. Image quality loss will accumulate; after ten or so cycles the image
367may be noticeably worse than it was after one cycle. It's best to use a 367may be noticeably worse than it was after one cycle. It's best to use a
368lossless format while manipulating an image, then convert to JPEG format when 368lossless format while manipulating an image, then convert to JPEG format when
369you are ready to file the image away. 369you are ready to file the image away.
370 370
371The -optimize option to cjpeg is worth using when you are making a "final" 371The -optimize option to cjpeg is worth using when you are making a "final"
372version for posting or archiving. It's also a win when you are using low 372version for posting or archiving. It's also a win when you are using low
373quality settings to make very small JPEG files; the percentage improvement 373quality settings to make very small JPEG files; the percentage improvement
374is often a lot more than it is on larger files. (At present, -optimize 374is often a lot more than it is on larger files. (At present, -optimize
375mode is always selected when generating progressive JPEG files.) 375mode is always selected when generating progressive JPEG files.)
376 376
377GIF input files are no longer supported, to avoid the Unisys LZW patent. 377GIF input files are no longer supported, to avoid the Unisys LZW patent.
378(Conversion of GIF files to JPEG is usually a bad idea anyway.) 378(Conversion of GIF files to JPEG is usually a bad idea anyway.)
379 379
380 380
381HINTS FOR DJPEG 381HINTS FOR DJPEG
382 382
383To get a quick preview of an image, use the -grayscale and/or -scale switches. 383To get a quick preview of an image, use the -grayscale and/or -scale switches.
384"-grayscale -scale 1/8" is the fastest case. 384"-grayscale -scale 1/8" is the fastest case.
385 385
386Several options are available that trade off image quality to gain speed. 386Several options are available that trade off image quality to gain speed.
387"-fast" turns on the recommended settings. 387"-fast" turns on the recommended settings.
388 388
389"-dct fast" and/or "-nosmooth" gain speed at a small sacrifice in quality. 389"-dct fast" and/or "-nosmooth" gain speed at a small sacrifice in quality.
390When producing a color-quantized image, "-onepass -dither ordered" is fast but 390When producing a color-quantized image, "-onepass -dither ordered" is fast but
391much lower quality than the default behavior. "-dither none" may give 391much lower quality than the default behavior. "-dither none" may give
392acceptable results in two-pass mode, but is seldom tolerable in one-pass mode. 392acceptable results in two-pass mode, but is seldom tolerable in one-pass mode.
393 393
394If you are fortunate enough to have very fast floating point hardware, 394If you are fortunate enough to have very fast floating point hardware,
395"-dct float" may be even faster than "-dct fast". But on most machines 395"-dct float" may be even faster than "-dct fast". But on most machines
396"-dct float" is slower than "-dct int"; in this case it is not worth using, 396"-dct float" is slower than "-dct int"; in this case it is not worth using,
397because its theoretical accuracy advantage is too small to be significant 397because its theoretical accuracy advantage is too small to be significant
398in practice. 398in practice.
399 399
400Two-pass color quantization requires a good deal of memory; on MS-DOS machines 400Two-pass color quantization requires a good deal of memory; on MS-DOS machines
401it may run out of memory even with -maxmemory 0. In that case you can still 401it may run out of memory even with -maxmemory 0. In that case you can still
402decompress, with some loss of image quality, by specifying -onepass for 402decompress, with some loss of image quality, by specifying -onepass for
403one-pass quantization. 403one-pass quantization.
404 404
405To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These 405To avoid the Unisys LZW patent, djpeg produces uncompressed GIF files. These
406are larger than they should be, but are readable by standard GIF decoders. 406are larger than they should be, but are readable by standard GIF decoders.
407 407
408 408
409HINTS FOR BOTH PROGRAMS 409HINTS FOR BOTH PROGRAMS
410 410
411If more space is needed than will fit in the available main memory (as 411If more space is needed than will fit in the available main memory (as
412determined by -maxmemory), temporary files will be used. (MS-DOS versions 412determined by -maxmemory), temporary files will be used. (MS-DOS versions
413will try to get extended or expanded memory first.) The temporary files are 413will try to get extended or expanded memory first.) The temporary files are
414often rather large: in typical cases they occupy three bytes per pixel, for 414often rather large: in typical cases they occupy three bytes per pixel, for
415example 3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough 415example 3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough
416free disk space, leave out -progressive and -optimize (for cjpeg) or specify 416free disk space, leave out -progressive and -optimize (for cjpeg) or specify
417-onepass (for djpeg). 417-onepass (for djpeg).
418 418
419On MS-DOS, the temporary files are created in the directory named by the TMP 419On MS-DOS, the temporary files are created in the directory named by the TMP
420or TEMP environment variable, or in the current directory if neither of those 420or TEMP environment variable, or in the current directory if neither of those
421exist. Amiga implementations put the temp files in the directory named by 421exist. Amiga implementations put the temp files in the directory named by
422JPEGTMP:, so be sure to assign JPEGTMP: to a disk partition with adequate free 422JPEGTMP:, so be sure to assign JPEGTMP: to a disk partition with adequate free
423space. 423space.
424 424
425The default memory usage limit (-maxmemory) is set when the software is 425The default memory usage limit (-maxmemory) is set when the software is
426compiled. If you get an "insufficient memory" error, try specifying a smaller 426compiled. If you get an "insufficient memory" error, try specifying a smaller
427-maxmemory value, even -maxmemory 0 to use the absolute minimum space. You 427-maxmemory value, even -maxmemory 0 to use the absolute minimum space. You
428may want to recompile with a smaller default value if this happens often. 428may want to recompile with a smaller default value if this happens often.
429 429
430On machines that have "environment" variables, you can define the environment 430On machines that have "environment" variables, you can define the environment
431variable JPEGMEM to set the default memory limit. The value is specified as 431variable JPEGMEM to set the default memory limit. The value is specified as
432described for the -maxmemory switch. JPEGMEM overrides the default value 432described for the -maxmemory switch. JPEGMEM overrides the default value
433specified when the program was compiled, and itself is overridden by an 433specified when the program was compiled, and itself is overridden by an
434explicit -maxmemory switch. 434explicit -maxmemory switch.
435 435
436On MS-DOS machines, -maxmemory is the amount of main (conventional) memory to 436On MS-DOS machines, -maxmemory is the amount of main (conventional) memory to
437use. (Extended or expanded memory is also used if available.) Most 437use. (Extended or expanded memory is also used if available.) Most
438DOS-specific versions of this software do their own memory space estimation 438DOS-specific versions of this software do their own memory space estimation
439and do not need you to specify -maxmemory. 439and do not need you to specify -maxmemory.
440 440
441 441
442JPEGTRAN 442JPEGTRAN
443 443
444jpegtran performs various useful transformations of JPEG files. 444jpegtran performs various useful transformations of JPEG files.
445It can translate the coded representation from one variant of JPEG to another, 445It can translate the coded representation from one variant of JPEG to another,
446for example from baseline JPEG to progressive JPEG or vice versa. It can also 446for example from baseline JPEG to progressive JPEG or vice versa. It can also
447perform some rearrangements of the image data, for example turning an image 447perform some rearrangements of the image data, for example turning an image
448from landscape to portrait format by rotation. 448from landscape to portrait format by rotation.
449 449
450jpegtran works by rearranging the compressed data (DCT coefficients), without 450jpegtran works by rearranging the compressed data (DCT coefficients), without
451ever fully decoding the image. Therefore, its transformations are lossless: 451ever fully decoding the image. Therefore, its transformations are lossless:
452there is no image degradation at all, which would not be true if you used 452there is no image degradation at all, which would not be true if you used
453djpeg followed by cjpeg to accomplish the same conversion. But by the same 453djpeg followed by cjpeg to accomplish the same conversion. But by the same
454token, jpegtran cannot perform lossy operations such as changing the image 454token, jpegtran cannot perform lossy operations such as changing the image
455quality. 455quality.
456 456
457jpegtran uses a command line syntax similar to cjpeg or djpeg. 457jpegtran uses a command line syntax similar to cjpeg or djpeg.
458On Unix-like systems, you say: 458On Unix-like systems, you say:
459 jpegtran [switches] [inputfile] >outputfile 459 jpegtran [switches] [inputfile] >outputfile
460On most non-Unix systems, you say: 460On most non-Unix systems, you say:
461 jpegtran [switches] inputfile outputfile 461 jpegtran [switches] inputfile outputfile
462where both the input and output files are JPEG files. 462where both the input and output files are JPEG files.
463 463
464To specify the coded JPEG representation used in the output file, 464To specify the coded JPEG representation used in the output file,
465jpegtran accepts a subset of the switches recognized by cjpeg: 465jpegtran accepts a subset of the switches recognized by cjpeg:
466 -optimize Perform optimization of entropy encoding parameters. 466 -optimize Perform optimization of entropy encoding parameters.
467 -progressive Create progressive JPEG file. 467 -progressive Create progressive JPEG file.
468 -arithmetic Use arithmetic coding. 468 -arithmetic Use arithmetic coding.
469 -restart N Emit a JPEG restart marker every N MCU rows, or every 469 -restart N Emit a JPEG restart marker every N MCU rows, or every
470 N MCU blocks if "B" is attached to the number. 470 N MCU blocks if "B" is attached to the number.
471 -scans file Use the scan script given in the specified text file. 471 -scans file Use the scan script given in the specified text file.
472See the previous discussion of cjpeg for more details about these switches. 472See the previous discussion of cjpeg for more details about these switches.
473If you specify none of these switches, you get a plain baseline-JPEG output 473If you specify none of these switches, you get a plain baseline-JPEG output
474file. The quality setting and so forth are determined by the input file. 474file. The quality setting and so forth are determined by the input file.
475 475
476The image can be losslessly transformed by giving one of these switches: 476The image can be losslessly transformed by giving one of these switches:
477 -flip horizontal Mirror image horizontally (left-right). 477 -flip horizontal Mirror image horizontally (left-right).
478 -flip vertical Mirror image vertically (top-bottom). 478 -flip vertical Mirror image vertically (top-bottom).
479 -rotate 90 Rotate image 90 degrees clockwise. 479 -rotate 90 Rotate image 90 degrees clockwise.
480 -rotate 180 Rotate image 180 degrees. 480 -rotate 180 Rotate image 180 degrees.
481 -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw). 481 -rotate 270 Rotate image 270 degrees clockwise (or 90 ccw).
482 -transpose Transpose image (across UL-to-LR axis). 482 -transpose Transpose image (across UL-to-LR axis).
483 -transverse Transverse transpose (across UR-to-LL axis). 483 -transverse Transverse transpose (across UR-to-LL axis).
484 484
485The transpose transformation has no restrictions regarding image dimensions. 485The transpose transformation has no restrictions regarding image dimensions.
486The other transformations operate rather oddly if the image dimensions are not 486The other transformations operate rather oddly if the image dimensions are not
487a multiple of the iMCU size (usually 8 or 16 pixels), because they can only 487a multiple of the iMCU size (usually 8 or 16 pixels), because they can only
488transform complete blocks of DCT coefficient data in the desired way. 488transform complete blocks of DCT coefficient data in the desired way.
489 489
490jpegtran's default behavior when transforming an odd-size image is designed 490jpegtran's default behavior when transforming an odd-size image is designed
491to preserve exact reversibility and mathematical consistency of the 491to preserve exact reversibility and mathematical consistency of the
492transformation set. As stated, transpose is able to flip the entire image 492transformation set. As stated, transpose is able to flip the entire image
493area. Horizontal mirroring leaves any partial iMCU column at the right edge 493area. Horizontal mirroring leaves any partial iMCU column at the right edge
494untouched, but is able to flip all rows of the image. Similarly, vertical 494untouched, but is able to flip all rows of the image. Similarly, vertical
495mirroring leaves any partial iMCU row at the bottom edge untouched, but is 495mirroring leaves any partial iMCU row at the bottom edge untouched, but is
496able to flip all columns. The other transforms can be built up as sequences 496able to flip all columns. The other transforms can be built up as sequences
497of transpose and flip operations; for consistency, their actions on edge 497of transpose and flip operations; for consistency, their actions on edge
498pixels are defined to be the same as the end result of the corresponding 498pixels are defined to be the same as the end result of the corresponding
499transpose-and-flip sequence. 499transpose-and-flip sequence.
500 500
501For practical use, you may prefer to discard any untransformable edge pixels 501For practical use, you may prefer to discard any untransformable edge pixels
502rather than having a strange-looking strip along the right and/or bottom edges 502rather than having a strange-looking strip along the right and/or bottom edges
503of a transformed image. To do this, add the -trim switch: 503of a transformed image. To do this, add the -trim switch:
504 -trim Drop non-transformable edge blocks. 504 -trim Drop non-transformable edge blocks.
505Obviously, a transformation with -trim is not reversible, so strictly speaking 505Obviously, a transformation with -trim is not reversible, so strictly speaking
506jpegtran with this switch is not lossless. Also, the expected mathematical 506jpegtran with this switch is not lossless. Also, the expected mathematical
507equivalences between the transformations no longer hold. For example, 507equivalences between the transformations no longer hold. For example,
508"-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by 508"-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by
509"-rot 180 -trim" trims both edges. 509"-rot 180 -trim" trims both edges.
510 510
511If you are only interested in perfect transformation, add the -perfect switch: 511If you are only interested in perfect transformation, add the -perfect switch:
512 -perfect Fails with an error if the transformation is not 512 -perfect Fails with an error if the transformation is not
513 perfect. 513 perfect.
514For example you may want to do 514For example you may want to do
515 jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg 515 jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg
516to do a perfect rotation if available or an approximated one if not. 516to do a perfect rotation if available or an approximated one if not.
517 517
518We also offer a lossless-crop option, which discards data outside a given 518We also offer a lossless-crop option, which discards data outside a given
519image region but losslessly preserves what is inside. Like the rotate and 519image region but losslessly preserves what is inside. Like the rotate and
520flip transforms, lossless crop is restricted by the current JPEG format: the 520flip transforms, lossless crop is restricted by the current JPEG format: the
521upper left corner of the selected region must fall on an iMCU boundary. If 521upper left corner of the selected region must fall on an iMCU boundary. If
522this does not hold for the given crop parameters, we silently move the upper 522this does not hold for the given crop parameters, we silently move the upper
523left corner up and/or left to make it so, simultaneously increasing the region 523left corner up and/or left to make it so, simultaneously increasing the region
524dimensions to keep the lower right crop corner unchanged. (Thus, the output 524dimensions to keep the lower right crop corner unchanged. (Thus, the output
525image covers at least the requested region, but may cover more.) 525image covers at least the requested region, but may cover more.)
526 526
527The image can be losslessly cropped by giving the switch: 527The image can be losslessly cropped by giving the switch:
528 -crop WxH+X+Y Crop to a rectangular subarea of width W, height H 528 -crop WxH+X+Y Crop to a rectangular subarea of width W, height H
529 starting at point X,Y. 529 starting at point X,Y.
530 530
531Other not-strictly-lossless transformation switches are: 531Other not-strictly-lossless transformation switches are:
532 532
533 -grayscale Force grayscale output. 533 -grayscale Force grayscale output.
534This option discards the chrominance channels if the input image is YCbCr 534This option discards the chrominance channels if the input image is YCbCr
535(ie, a standard color JPEG), resulting in a grayscale JPEG file. The 535(ie, a standard color JPEG), resulting in a grayscale JPEG file. The
536luminance channel is preserved exactly, so this is a better method of reducing 536luminance channel is preserved exactly, so this is a better method of reducing
537to grayscale than decompression, conversion, and recompression. This switch 537to grayscale than decompression, conversion, and recompression. This switch
538is particularly handy for fixing a monochrome picture that was mistakenly 538is particularly handy for fixing a monochrome picture that was mistakenly
539encoded as a color JPEG. (In such a case, the space savings from getting rid 539encoded as a color JPEG. (In such a case, the space savings from getting rid
540of the near-empty chroma channels won't be large; but the decoding time for 540of the near-empty chroma channels won't be large; but the decoding time for
541a grayscale JPEG is substantially less than that for a color JPEG.) 541a grayscale JPEG is substantially less than that for a color JPEG.)
542 542
543 -scale M/N Scale the output image by a factor M/N. 543 -scale M/N Scale the output image by a factor M/N.
544Currently supported scale factors are M/N with all M from 1 to 16, where N is 544Currently supported scale factors are M/N with all M from 1 to 16, where N is
545the source DCT size, which is 8 for baseline JPEG. If the /N part is omitted, 545the source DCT size, which is 8 for baseline JPEG. If the /N part is omitted,
546then M specifies the DCT scaled size to be applied on the given input. For 546then M specifies the DCT scaled size to be applied on the given input. For
547baseline JPEG this is equivalent to M/8 scaling, since the source DCT size 547baseline JPEG this is equivalent to M/8 scaling, since the source DCT size
548for baseline JPEG is 8. CAUTION: An implementation of the JPEG SmartScale 548for baseline JPEG is 8. CAUTION: An implementation of the JPEG SmartScale
549extension is required for this feature. SmartScale enabled JPEG is not yet 549extension is required for this feature. SmartScale enabled JPEG is not yet
550widely implemented, so many decoders will be unable to view a SmartScale 550widely implemented, so many decoders will be unable to view a SmartScale
551extended JPEG file at all. 551extended JPEG file at all.
552 552
553jpegtran also recognizes these switches that control what to do with "extra" 553jpegtran also recognizes these switches that control what to do with "extra"
554markers, such as comment blocks: 554markers, such as comment blocks:
555 -copy none Copy no extra markers from source file. This setting 555 -copy none Copy no extra markers from source file. This setting
556 suppresses all comments and other excess baggage 556 suppresses all comments and other excess baggage
557 present in the source file. 557 present in the source file.
558 -copy comments Copy only comment markers. This setting copies 558 -copy comments Copy only comment markers. This setting copies
559 comments from the source file, but discards 559 comments from the source file, but discards
560 any other inessential (for image display) data. 560 any other inessential (for image display) data.
561 -copy all Copy all extra markers. This setting preserves 561 -copy all Copy all extra markers. This setting preserves
562 miscellaneous markers found in the source file, such 562 miscellaneous markers found in the source file, such
563 as JFIF thumbnails, Exif data, and Photoshop settings. 563 as JFIF thumbnails, Exif data, and Photoshop settings.
564 In some files these extra markers can be sizable. 564 In some files these extra markers can be sizable.
565The default behavior is -copy comments. (Note: in IJG releases v6 and v6a, 565The default behavior is -copy comments. (Note: in IJG releases v6 and v6a,
566jpegtran always did the equivalent of -copy none.) 566jpegtran always did the equivalent of -copy none.)
567 567
568Additional switches recognized by jpegtran are: 568Additional switches recognized by jpegtran are:
569 -outfile filename 569 -outfile filename
570 -maxmemory N 570 -maxmemory N
571 -verbose 571 -verbose
572 -debug 572 -debug
573These work the same as in cjpeg or djpeg. 573These work the same as in cjpeg or djpeg.
574 574
575 575
576THE COMMENT UTILITIES 576THE COMMENT UTILITIES
577 577
578The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file. 578The JPEG standard allows "comment" (COM) blocks to occur within a JPEG file.
579Although the standard doesn't actually define what COM blocks are for, they 579Although the standard doesn't actually define what COM blocks are for, they
580are widely used to hold user-supplied text strings. This lets you add 580are widely used to hold user-supplied text strings. This lets you add
581annotations, titles, index terms, etc to your JPEG files, and later retrieve 581annotations, titles, index terms, etc to your JPEG files, and later retrieve
582them as text. COM blocks do not interfere with the image stored in the JPEG 582them as text. COM blocks do not interfere with the image stored in the JPEG
583file. The maximum size of a COM block is 64K, but you can have as many of 583file. The maximum size of a COM block is 64K, but you can have as many of
584them as you like in one JPEG file. 584them as you like in one JPEG file.
585 585
586We provide two utility programs to display COM block contents and add COM 586We provide two utility programs to display COM block contents and add COM
587blocks to a JPEG file. 587blocks to a JPEG file.
588 588
589rdjpgcom searches a JPEG file and prints the contents of any COM blocks on 589rdjpgcom searches a JPEG file and prints the contents of any COM blocks on
590standard output. The command line syntax is 590standard output. The command line syntax is
591 rdjpgcom [-raw] [-verbose] [inputfilename] 591 rdjpgcom [-raw] [-verbose] [inputfilename]
592The switch "-raw" (or just "-r") causes rdjpgcom to also output non-printable 592The switch "-raw" (or just "-r") causes rdjpgcom to also output non-printable
593characters in comments, which are normally escaped for security reasons. 593characters in comments, which are normally escaped for security reasons.
594The switch "-verbose" (or just "-v") causes rdjpgcom to also display the JPEG 594The switch "-verbose" (or just "-v") causes rdjpgcom to also display the JPEG
595image dimensions. If you omit the input file name from the command line, 595image dimensions. If you omit the input file name from the command line,
596the JPEG file is read from standard input. (This may not work on some 596the JPEG file is read from standard input. (This may not work on some
597operating systems, if binary data can't be read from stdin.) 597operating systems, if binary data can't be read from stdin.)
598 598
599wrjpgcom adds a COM block, containing text you provide, to a JPEG file. 599wrjpgcom adds a COM block, containing text you provide, to a JPEG file.
600Ordinarily, the COM block is added after any existing COM blocks, but you 600Ordinarily, the COM block is added after any existing COM blocks, but you
601can delete the old COM blocks if you wish. wrjpgcom produces a new JPEG 601can delete the old COM blocks if you wish. wrjpgcom produces a new JPEG
602file; it does not modify the input file. DO NOT try to overwrite the input 602file; it does not modify the input file. DO NOT try to overwrite the input
603file by directing wrjpgcom's output back into it; on most systems this will 603file by directing wrjpgcom's output back into it; on most systems this will
604just destroy your file. 604just destroy your file.
605 605
606The command line syntax for wrjpgcom is similar to cjpeg's. On Unix-like 606The command line syntax for wrjpgcom is similar to cjpeg's. On Unix-like
607systems, it is 607systems, it is
608 wrjpgcom [switches] [inputfilename] 608 wrjpgcom [switches] [inputfilename]
609The output file is written to standard output. The input file comes from 609The output file is written to standard output. The input file comes from
610the named file, or from standard input if no input file is named. 610the named file, or from standard input if no input file is named.
611 611
612On most non-Unix systems, the syntax is 612On most non-Unix systems, the syntax is
613 wrjpgcom [switches] inputfilename outputfilename 613 wrjpgcom [switches] inputfilename outputfilename
614where both input and output file names must be given explicitly. 614where both input and output file names must be given explicitly.
615 615
616wrjpgcom understands three switches: 616wrjpgcom understands three switches:
617 -replace Delete any existing COM blocks from the file. 617 -replace Delete any existing COM blocks from the file.
618 -comment "Comment text" Supply new COM text on command line. 618 -comment "Comment text" Supply new COM text on command line.
619 -cfile name Read text for new COM block from named file. 619 -cfile name Read text for new COM block from named file.
620(Switch names can be abbreviated.) If you have only one line of comment text 620(Switch names can be abbreviated.) If you have only one line of comment text
621to add, you can provide it on the command line with -comment. The comment 621to add, you can provide it on the command line with -comment. The comment
622text must be surrounded with quotes so that it is treated as a single 622text must be surrounded with quotes so that it is treated as a single
623argument. Longer comments can be read from a text file. 623argument. Longer comments can be read from a text file.
624 624
625If you give neither -comment nor -cfile, then wrjpgcom will read the comment 625If you give neither -comment nor -cfile, then wrjpgcom will read the comment
626text from standard input. (In this case an input image file name MUST be 626text from standard input. (In this case an input image file name MUST be
627supplied, so that the source JPEG file comes from somewhere else.) You can 627supplied, so that the source JPEG file comes from somewhere else.) You can
628enter multiple lines, up to 64KB worth. Type an end-of-file indicator 628enter multiple lines, up to 64KB worth. Type an end-of-file indicator
629(usually control-D or control-Z) to terminate the comment text entry. 629(usually control-D or control-Z) to terminate the comment text entry.
630 630
631wrjpgcom will not add a COM block if the provided comment string is empty. 631wrjpgcom will not add a COM block if the provided comment string is empty.
632Therefore -replace -comment "" can be used to delete all COM blocks from a 632Therefore -replace -comment "" can be used to delete all COM blocks from a
633file. 633file.
634 634
635These utility programs do not depend on the IJG JPEG library. In 635These utility programs do not depend on the IJG JPEG library. In
636particular, the source code for rdjpgcom is intended as an illustration of 636particular, the source code for rdjpgcom is intended as an illustration of
637the minimum amount of code required to parse a JPEG file header correctly. 637the minimum amount of code required to parse a JPEG file header correctly.