pamflip { -leftright | -lr | -topbottom | -tb | -transpose | -xy |
-rotate90 | -r90 | -cw | -rotate270 | -r270 | -ccw | -rotate180 |
-r180 -null | -xform=xform1,xform2... } [-memsize=mebibytes] [-page-
size=bytes] [pamfile]

All options can be abbreviated to their shortest unique prefix. You
may use two hyphens instead of one to designate an option. You may
use either white space or an equals sign between an option name and
its value.

This program is part of Netpbm.

pamflip flips a PAM or PNM image top for bottom or left for right, or
transposes it horizontal for vertical, or rotates it 1, 2, or 3 quar-
ter turns.

To rotate at other angles, use pnmrotate. It is much slower, though.

The input image is pamfile, or Standard Input if pamfile is not speci-

To flip/rotate a JFIF (JPEG) image losslessly, use jpegtran. jpegtran
is part of the Independent Jpeg Group's compression library package,
not part of Netpbm. The normal Netpbm way to flip a JFIF file would
be to convert it to PNM, use pamflip, and convert back to JFIF. But
since JPEG compression is lossy, the resulting image would have less
quality than the original. jpegtran, on the other hand, can do this
particular transformation directly on the compressed data without

You must supply exactly one of the following options:

pamflip's predecessor (before Netpbm 10.7 - August 2002) pnmflip did
not have the -xform option and instead allowed you to specify any num-
ber of the other options, including zero. It applied all the indi-
cated transformations, in the order given, just like with pamflip's
-xform option. (Reason for the change: this kind of interpretation of
options is inconsistent with the rest of Netpbm and most of the Unix
world, and thus hard to understand and to implement).


-lr Flip left for right.


-tb Flip top for bottom.


-xy Transpose horizontal for vertical. I.e. make the pixel at



-ccw Rotate counterclockwise 90 degrees.


-r180 Rotate 180 degrees.



-cw Rotate counterclockwise 270 degrees (clockwise 90 degrees)

-null No change. (The purpose of this option is the convenience of


? leftright

? topbottom

? transpose

The following options help pamflip use memory efficiently. Some flip-
ping operations on very large images can cause pamflip to have a very
large working set, which means if you don't have enough real memory,
the program can page thrash, which means it takes a ridiculous amount
time to run. If your entire image fits in real memory, you don't have
a problem. If you're just flipping top for bottom or left for right,
you don't have a problem. Otherwise, pay attention. If you're inter-
ested in the details of the thrashing problem and how pamflip
approaches it, you're invited to read a complete explanation in com-
ments in the source code.




pnmrotate, pnm, pam, jpegtran manual

pamflip replaced pnmflip in Netpbm 10.13 (December 2002). pamflip is
backward compatible, but also works on PAM images.

Copyright (C) 1989 by Jef Poskanzer.

netpbm documentation 20 January 2008 Pamflip User Manual(0)