1Pamflip User Manual(0) Pamflip User Manual(0)
2
3
4
6 pamflip - flip or rotate a PAM or PNM image
7
8
10 pamflip { -leftright | -lr | -topbottom | -tb | -transpose | -xy |
11 -rotate90 | -r90 | -cw | -rotate270 | -r270 | -ccw | -rotate180 | -r180
12 -null | -xform=xform1,xform2... } [-memsize=mebibytes] [-page‐
13 size=bytes] [pamfile]
14
15 All options can be abbreviated to their shortest unique prefix. You
16 may use two hyphens instead of one to designate an option. You may use
17 either white space or an equals sign between an option name and its
18 value.
19
20
21
23 This program is part of Netpbm(1).
24
25 pamflip flips a PAM or PNM image top for bottom or left for right, or
26 transposes it horizontal for vertical, or rotates it 1, 2, or 3 quarter
27 turns.
28
29 To rotate at other angles, use pnmrotate. It is much slower, though.
30
31 The input image is pamfile, or Standard Input if pamfile is not speci‐
32 fied.
33
34 To flip/rotate a JFIF (JPEG) image losslessly, use jpegtran. jpegtran
35 is part of the Independent Jpeg Group's compression library package,
36 not part of Netpbm. The normal Netpbm way to flip a JFIF file would be
37 to convert it to PNM, use pamflip, and convert back to JFIF. But since
38 JPEG compression is lossy, the resulting image would have less quality
39 than the original. jpegtran, on the other hand, can do this particular
40 transformation directly on the compressed data without loss.
41
42
43
45 You must supply exactly one of the following options:
46
47 pamflip's predecessor (before Netpbm 10.7 - August 2002) pnmflip did
48 not have the -xform option and instead allowed you to specify any num‐
49 ber of the other options, including zero. It applied all the indicated
50 transformations, in the order given, just like with pamflip's -xform
51 option. (Reason for the change: this kind of interpretation of options
52 is inconsistent with the rest of Netpbm and most of the Unix world, and
53 thus hard to understand and to implement).
54
55
56
57 -leftright
58
59 -lr Flip left for right.
60
61
62 -topbottom
63
64 -tb Flip top for bottom.
65
66
67 -transpose
68
69 -xy Transpose horizontal for vertical. I.e. make the pixel at (x,y)
70 be at (y,x).
71
72
73 -rotate90
74
75 -r90
76
77 -ccw Rotate counterclockwise 90 degrees.
78
79
80 -rotate180
81
82 -r180 Rotate 180 degrees.
83
84
85 -rotate270
86
87 -r270
88
89 -cw Rotate counterclockwise 270 degrees (clockwise 90 degrees)
90
91
92 -null No change. (The purpose of this option is the convenience of
93 programs that invoke pamflip after computing the kind of trans‐
94 formation desired, including none at all).
95
96 This option was new in Netpbm 10.13 (December 2002).
97
98
99 -xform=xform1,xform2...
100 Apply all the transforms listed, in order. The valid values for
101 the transforms are as follows and have the same meanings as the
102 identically named options above.
103
104
105 · leftright
106
107 · topbottom
108
109 · transpose
110
111
112 This option was new in Netpbm 10.13 (December 2002).
113
114
115
116 The following options help pamflip use memory efficiently. Some flip‐
117 ping operations on very large images can cause pamflip to have a very
118 large working set, which means if you don't have enough real memory,
119 the program can page thrash, which means it takes a ridiculous amount
120 time to run. If your entire image fits in real memory, you don't have
121 a problem. If you're just flipping top for bottom or left for right,
122 you don't have a problem. Otherwise, pay attention. If you're inter‐
123 ested in the details of the thrashing problem and how pamflip
124 approaches it, you're invited to read a complete explanation in com‐
125 ments in the source code.
126
127
128
129 -memsize=mebibytes
130 mebibytes is the size in mebibytes (aka megabytes) of memory
131 available for pamflip. It is the lesser of the amount of real
132 or virtual memory available.
133
134 pamflip does nothing special to allocate real memory or control
135 it's allocation -- it gets whatever it gets just by referencing
136 virtual memory normally. The real memory figure in question is
137 the maximum amount that pamflip can be expected to end up with
138 by doing that. This is just about impossible for you to know,
139 of course, but you can estimate. The total real memory in your
140 system should be a major factor in your estimate.
141
142 If pamflip cannot fit the entire image in the amount of memory
143 you specify, it does the transformation in chunks, using tempo‐
144 rary files for intermediate results.
145
146 Strict horizontal transformations (either left for right or
147 null), pamflip never keeps more than one row in memory, so the
148 memory size is irrelevant and pamflip doesn't use temporary
149 files.
150
151 The real memory is important when you do a column for row type
152 of transformation (e.g. -rotate90). In that case, even if pam‐
153 flip can fit the entire image in virtual memory at once, if it
154 does not also fit in real memory, the program will thrash like
155 crazy because of the order in which pamflip accesses the pixels,
156 and that means it will take a ridiculously long time to run. A
157 proper -memsize drastically reduces the paging.
158
159 If you specify -memsize too large, pamflip may attempt to get
160 more virtual memory than the system allows it and fail. If it
161 can get the virtual memory, but -memsize is larger than the
162 amount of real memory the system allows it and the transforma‐
163 tion is row for column, it will page thrash and run very slowly.
164 A value even slightly too high is the same as infinity.
165
166 If you specify -memsize too small, the program will run slightly
167 more slowly due to extra overhead in manipulating temporary
168 files. Also, if your environment isn't set up to make temporary
169 files possible, pamflip will fail.
170
171 Doing the entire transformation 'in memory' doesn't speed things
172 up as much as you might think, because even with the temporary
173 files, the data is just as likely to be in memory. Virtual mem‐
174 ory gets paged to disk and disk files get cached in memory. In
175 fact, the pixels fit much more compactly into memory when stored
176 in a temporary file than when stored 'in memory' because pamflip
177 uses a more efficient format. So you're likely to have less
178 disk I/O when you allow pamflip less memory.
179
180 If you do not specify -memsize, pamflip assumes infinity.
181
182 This option did not exist before Netpbm 10.7 (August 2002).
183
184 Before Netpbm 10.42 (March 2008), this option applied only to
185 real memory. pamflip would always keep the entire image in vir‐
186 tual memory and if it could not get enough virtual memory, it
187 failed. pamflip accessed the pixels in an order designed to
188 keep real memory use within the specified amount.
189
190
191 -pagesize=bytes
192 bytes is the size in bytes of a paging unit -- the amount of
193 memory that gets paged in or out as an indivisible unit -- in
194 your system. The default is 4KiB.
195
196 This option has no effect.
197
198 Before Netpbm 10.42 (March 2008), pamflip used it to control its
199 use of real memory.
200
201 This option did not exist before Netpbm 10.7 (August 2002).
202
203
204
205 Miscellaneous options:
206
207
208 -verbose
209 This option causes pamflip to issue messages to Standard Error
210 about its progress.
211
212
213
214
216 pnmrotate(1), pnm(1), pam(1), jpegtran manual
217
218
220 pamflip replaced pnmflip in Netpbm 10.13 (December 2002). pamflip is
221 backward compatible, but also works on PAM images.
222
223
224
226 Copyright (C) 1989 by Jef Poskanzer.
227
228
229
230netpbm documentation 20 January 2008 Pamflip User Manual(0)