comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/man/man1/jpegtran.1 @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 68:5028fdace37b
1 .TH JPEGTRAN 1 "28 August 2019"
2 .SH NAME
3 jpegtran \- lossless transformation of JPEG files
4 .SH SYNOPSIS
5 .B jpegtran
6 [
7 .I options
8 ]
9 [
10 .I filename
11 ]
12 .LP
13 .SH DESCRIPTION
14 .LP
15 .B jpegtran
16 performs various useful transformations of JPEG files.
17 It can translate the coded representation from one variant of JPEG to another,
18 for example from baseline JPEG to progressive JPEG or vice versa. It can also
19 perform some rearrangements of the image data, for example turning an image
20 from landscape to portrait format by rotation.
21 .PP
22 For EXIF files and JPEG files containing Exif data, you may prefer to use
23 .B exiftran
24 instead.
25 .PP
26 .B jpegtran
27 works by rearranging the compressed data (DCT coefficients), without
28 ever fully decoding the image. Therefore, its transformations are lossless:
29 there is no image degradation at all, which would not be true if you used
30 .B djpeg
31 followed by
32 .B cjpeg
33 to accomplish the same conversion. But by the same token,
34 .B jpegtran
35 cannot perform lossy operations such as changing the image quality. However,
36 while the image data is losslessly transformed, metadata can be removed. See
37 the
38 .B \-copy
39 option for specifics.
40 .PP
41 .B jpegtran
42 reads the named JPEG/JFIF file, or the standard input if no file is
43 named, and produces a JPEG/JFIF file on the standard output.
44 .SH OPTIONS
45 All switch names may be abbreviated; for example,
46 .B \-optimize
47 may be written
48 .B \-opt
49 or
50 .BR \-o .
51 Upper and lower case are equivalent.
52 British spellings are also accepted (e.g.,
53 .BR \-optimise ),
54 though for brevity these are not mentioned below.
55 .PP
56 To specify the coded JPEG representation used in the output file,
57 .B jpegtran
58 accepts a subset of the switches recognized by
59 .BR cjpeg :
60 .TP
61 .B \-optimize
62 Perform optimization of entropy encoding parameters.
63 .TP
64 .B \-progressive
65 Create progressive JPEG file.
66 .TP
67 .BI \-restart " N"
68 Emit a JPEG restart marker every N MCU rows, or every N MCU blocks if "B" is
69 attached to the number.
70 .TP
71 .B \-arithmetic
72 Use arithmetic coding.
73 .TP
74 .BI \-scans " file"
75 Use the scan script given in the specified text file.
76 .PP
77 See
78 .BR cjpeg (1)
79 for more details about these switches.
80 If you specify none of these switches, you get a plain baseline-JPEG output
81 file. The quality setting and so forth are determined by the input file.
82 .PP
83 The image can be losslessly transformed by giving one of these switches:
84 .TP
85 .B \-flip horizontal
86 Mirror image horizontally (left-right).
87 .TP
88 .B \-flip vertical
89 Mirror image vertically (top-bottom).
90 .TP
91 .B \-rotate 90
92 Rotate image 90 degrees clockwise.
93 .TP
94 .B \-rotate 180
95 Rotate image 180 degrees.
96 .TP
97 .B \-rotate 270
98 Rotate image 270 degrees clockwise (or 90 ccw).
99 .TP
100 .B \-transpose
101 Transpose image (across UL-to-LR axis).
102 .TP
103 .B \-transverse
104 Transverse transpose (across UR-to-LL axis).
105 .IP
106 The transpose transformation has no restrictions regarding image dimensions.
107 The other transformations operate rather oddly if the image dimensions are not
108 a multiple of the iMCU size (usually 8 or 16 pixels), because they can only
109 transform complete blocks of DCT coefficient data in the desired way.
110 .IP
111 .BR jpegtran 's
112 default behavior when transforming an odd-size image is designed
113 to preserve exact reversibility and mathematical consistency of the
114 transformation set. As stated, transpose is able to flip the entire image
115 area. Horizontal mirroring leaves any partial iMCU column at the right edge
116 untouched, but is able to flip all rows of the image. Similarly, vertical
117 mirroring leaves any partial iMCU row at the bottom edge untouched, but is
118 able to flip all columns. The other transforms can be built up as sequences
119 of transpose and flip operations; for consistency, their actions on edge
120 pixels are defined to be the same as the end result of the corresponding
121 transpose-and-flip sequence.
122 .IP
123 For practical use, you may prefer to discard any untransformable edge pixels
124 rather than having a strange-looking strip along the right and/or bottom edges
125 of a transformed image. To do this, add the
126 .B \-trim
127 switch:
128 .TP
129 .B \-trim
130 Drop non-transformable edge blocks.
131 .IP
132 Obviously, a transformation with
133 .B \-trim
134 is not reversible, so strictly speaking
135 .B jpegtran
136 with this switch is not lossless. Also, the expected mathematical
137 equivalences between the transformations no longer hold. For example,
138 .B \-rot 270 -trim
139 trims only the bottom edge, but
140 .B \-rot 90 -trim
141 followed by
142 .B \-rot 180 -trim
143 trims both edges.
144 .IP
145 If you are only interested in perfect transformation, add the
146 .B \-perfect
147 switch:
148 .TP
149 .B \-perfect
150 Fails with an error if the transformation is not perfect.
151 .IP
152 For example you may want to do
153 .IP
154 .B (jpegtran \-rot 90 -perfect
155 .I foo.jpg
156 .B || djpeg
157 .I foo.jpg
158 .B | pnmflip \-r90 | cjpeg)
159 .IP
160 to do a perfect rotation if available or an approximated one if not.
161 .PP
162 We also offer a lossless-crop option, which discards data outside a given
163 image region but losslessly preserves what is inside. Like the rotate and
164 flip transforms, lossless crop is restricted by the current JPEG format: the
165 upper left corner of the selected region must fall on an iMCU boundary. If
166 this does not hold for the given crop parameters, we silently move the upper
167 left corner up and/or left to make it so, simultaneously increasing the
168 region dimensions to keep the lower right crop corner unchanged. (Thus, the
169 output image covers at least the requested region, but may cover more.)
170 The adjustment of the region dimensions may be optionally disabled by
171 attaching an 'f' character ("force") to the width or height number.
172 .PP
173 The image can be losslessly cropped by giving the switch:
174 .TP
175 .B \-crop WxH+X+Y
176 Crop to a rectangular subarea of width W, height H starting at point X,Y.
177 .PP
178 Crop extension: The width or height parameters can be made larger than the
179 source image. In this case the extra area is filled in with zero (neutral
180 gray). A larger width parameter has two more options: Attaching an 'f'
181 character ("flatten") to the width number will fill in the extra area with
182 the DC of the adjacent block, instead of gray out. Attaching an 'r'
183 character ("reflect") to the width number will fill in the extra area with
184 repeated reflections of the source region, instead of gray out.
185 .PP
186 A complementary lossless-wipe option is provided to discard (gray out) data
187 inside a given image region while losslessly preserving what is outside:
188 .TP
189 .B \-wipe WxH+X+Y
190 Wipe (gray out) a rectangular subarea of width W, height H starting at point
191 X,Y.
192 .PP
193 Attaching an 'f' character ("flatten") to the width number will fill the
194 region with the average of adjacent blocks, instead of gray out. In case
195 the wipe region and outside area form two horizontally adjacent rectangles,
196 attaching an 'r' character ("reflect") to the width number will fill the
197 region with repeated reflections of the outside area, instead of gray out.
198 .PP
199 Another option is lossless-drop, which replaces data at a given image
200 position by another image:
201 .TP
202 .B \-drop +X+Y filename
203 Drop another image
204 .PP
205 Both source images must have the same subsampling values. It is best if
206 they also have the same quantization, otherwise quantization adaption occurs.
207 The trim option can be used with the drop option to requantize the drop file
208 to the source file.
209 .PP
210 Other not-strictly-lossless transformation switches are:
211 .TP
212 .B \-grayscale
213 Force grayscale output.
214 .IP
215 This option discards the chrominance channels if the input image is YCbCr
216 (ie, a standard color JPEG), resulting in a grayscale JPEG file. The
217 luminance channel is preserved exactly, so this is a better method of reducing
218 to grayscale than decompression, conversion, and recompression. This switch
219 is particularly handy for fixing a monochrome picture that was mistakenly
220 encoded as a color JPEG. (In such a case, the space savings from getting rid
221 of the near-empty chroma channels won't be large; but the decoding time for
222 a grayscale JPEG is substantially less than that for a color JPEG.)
223 .TP
224 .BI \-scale " M/N"
225 Scale the output image by a factor M/N.
226 .IP
227 Currently supported scale factors are M/N with all M from 1 to 16, where N is
228 the source DCT size, which is 8 for baseline JPEG. If the /N part is omitted,
229 then M specifies the DCT scaled size to be applied on the given input. For
230 baseline JPEG this is equivalent to M/8 scaling, since the source DCT size
231 for baseline JPEG is 8.
232 .B Caution:
233 An implementation of the JPEG SmartScale extension is required for this
234 feature. SmartScale enabled JPEG is not yet widely implemented, so many
235 decoders will be unable to view a SmartScale extended JPEG file at all.
236 .PP
237 .B jpegtran
238 also recognizes these switches that control what to do with "extra" markers,
239 such as comment blocks:
240 .TP
241 .B \-copy none
242 Copy no extra markers from source file. This setting suppresses all
243 comments and other metadata in the source file.
244 .TP
245 .B \-copy comments
246 Copy only comment markers. This setting copies comments from the source file,
247 but discards any other metadata.
248 .TP
249 .B \-copy all
250 Copy all extra markers. This setting preserves metadata
251 found in the source file, such as JFIF thumbnails, Exif data, and Photoshop
252 settings. In some files these extra markers can be sizable. Note that this
253 option will copy thumbnails as-is; they will not be transformed.
254 .IP
255 The default behavior is
256 .BR "\-copy comments" .
257 (Note: in IJG releases v6 and v6a,
258 .B jpegtran
259 always did the equivalent of
260 .BR "\-copy none" .)
261 .PP
262 Additional switches recognized by jpegtran are:
263 .TP
264 .BI \-maxmemory " N"
265 Set limit for amount of memory to use in processing large images. Value is
266 in thousands of bytes, or millions of bytes if "M" is attached to the
267 number. For example,
268 .B \-max 4m
269 selects 4000000 bytes. If more space is needed, temporary files will be used.
270 .TP
271 .BI \-outfile " name"
272 Send output image to the named file, not to standard output.
273 .TP
274 .B \-verbose
275 Enable debug printout. More
276 .BR \-v 's
277 give more output. Also, version information is printed at startup.
278 .TP
279 .B \-debug
280 Same as
281 .BR \-verbose .
282 .SH EXAMPLES
283 .LP
284 This example converts a baseline JPEG file to progressive form:
285 .IP
286 .B jpegtran \-progressive
287 .I foo.jpg
288 .B >
289 .I fooprog.jpg
290 .PP
291 This example rotates an image 90 degrees clockwise, discarding any
292 unrotatable edge pixels:
293 .IP
294 .B jpegtran \-rot 90 -trim
295 .I foo.jpg
296 .B >
297 .I foo90.jpg
298 .SH ENVIRONMENT
299 .TP
300 .B JPEGMEM
301 If this environment variable is set, its value is the default memory limit.
302 The value is specified as described for the
303 .B \-maxmemory
304 switch.
305 .B JPEGMEM
306 overrides the default value specified when the program was compiled, and
307 itself is overridden by an explicit
308 .BR \-maxmemory .
309 .SH SEE ALSO
310 .BR cjpeg (1),
311 .BR djpeg (1),
312 .BR rdjpgcom (1),
313 .BR wrjpgcom (1)
314 .br
315 Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
316 Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
317 .SH AUTHOR
318 Independent JPEG Group
319 .SH BUGS
320 The transform options can't transform odd-size images perfectly. Use
321 .B \-trim
322 or
323 .B \-perfect
324 if you don't like the results.
325 .PP
326 The entire image is read into memory and then written out again, even in
327 cases where this isn't really necessary. Expect swapping on large images,
328 especially when using the more complex transform options.