| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> |
| 2 |
<html><head><title>Pnmrotate User Manual</title></head> |
| 3 |
<body> |
| 4 |
<h1>pnmrotate</h1> |
| 5 |
Updated: 30 August 2002 |
| 6 |
<br> |
| 7 |
<a href="#index">Table Of Contents</a> |
| 8 |
|
| 9 |
<h2>NAME</h2> |
| 10 |
pnmrotate - rotate a PNM image by some angle |
| 11 |
|
| 12 |
<h2 id="synopsis">SYNOPSIS</h2> |
| 13 |
|
| 14 |
<b>pnmrotate</b> |
| 15 |
[<b>-noantialias</b>] [<b>-background=</b><i>color</i>] <i>angle</i> |
| 16 |
[<i>pnmfile</i>] |
| 17 |
|
| 18 |
<h2 id="description">DESCRIPTION</h2> |
| 19 |
|
| 20 |
<p>This program is part of <a href="index.html">Netpbm</a>. |
| 21 |
|
| 22 |
<b>pnmrotate</b> reads a PNM image as input. It rotates it by the |
| 23 |
specified angle and produces the same kind of PNM image as output. |
| 24 |
|
| 25 |
<p>The input is the file named by <i>pnmfile</i> or Standard Input if you |
| 26 |
don't specify <i>pnmfile</i>. The output goes to Standard Output. |
| 27 |
|
| 28 |
<p>The resulting image is a rectangle that contains the (rectangular) |
| 29 |
input image within it, rotated with respect to its bottom edge. The |
| 30 |
containing rectangle is as small as possible to contain the rotated |
| 31 |
image. The background of the containing image is a single color that |
| 32 |
<b>pnmrotate</b> determines to be the background color of the original |
| 33 |
image, or that you specify explicitly. |
| 34 |
|
| 35 |
<p><i>angle</i> is in decimal degrees (floating point), measured |
| 36 |
counter-clockwise. It can be negative, but it should be between -90 |
| 37 |
and 90. |
| 38 |
|
| 39 |
<p>You should use <b>pamflip</b> instead for rotations that are a |
| 40 |
multiple of a quarter turn. It is faster and more accurate. |
| 41 |
|
| 42 |
<p>For rotations greater than 45 degrees you may get better results if |
| 43 |
you first use <i>pamflip</i> to do a 90 degree rotation and then |
| 44 |
<i>pnmrotate</i> less than 45 degrees back the other direction. |
| 45 |
|
| 46 |
<p>The rotation algorithm is Alan Paeth's three-shear method. Each |
| 47 |
shear is implemented by looping over the source pixels and |
| 48 |
distributing fractions to each of the destination pixels. This has an |
| 49 |
"anti-aliasing" effect - it avoids jagged edges and similar |
| 50 |
artifacts. However, it also means that the original colors or gray |
| 51 |
levels in the image are modified. If you need to keep precisely the |
| 52 |
same set of colors, you can use the <b>-noantialias</b> option. |
| 53 |
|
| 54 |
<p>The program runs faster and uses less real memory with the |
| 55 |
<b>-noantialias</b> option. It uses a large amount of virtual memory |
| 56 |
either way, as it keeps a copy of the input image and a copy of the |
| 57 |
output image in memory, using 12 bytes per pixel for each. But with |
| 58 |
<b>-noantialias</b>, it accesses this memory sequentially in half a |
| 59 |
dozen passes, with only a few pages of memory at a time required in |
| 60 |
real memory. |
| 61 |
|
| 62 |
<p>In contrast, without <b>-noantialias</b>, the program's real memory |
| 63 |
working set size is one page per input image row plus one page per output |
| 64 |
image row. Before Netpbm 10.16 (June 2003), <b>-noantialias</b> had the |
| 65 |
same memory requirement. |
| 66 |
|
| 67 |
<h2 id="options">OPTIONS</h2> |
| 68 |
|
| 69 |
<p>In addition to the options common to all programs based on libnetpbm |
| 70 |
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions"> |
| 71 |
Common Options</a>), <b>pnmrotate</b> recognizes the following |
| 72 |
command line options: |
| 73 |
|
| 74 |
<p> |
| 75 |
All options can be abbreviated to their shortest unique prefix. You |
| 76 |
may use two hyphens instead of one to designate an option. You may |
| 77 |
use either white space or equals signs between an option name and its |
| 78 |
value. |
| 79 |
|
| 80 |
<dl compact> |
| 81 |
<dt><b>-background=</b><i>color</i> |
| 82 |
|
| 83 |
<dd>This determines the color of the background on which the rotated image |
| 84 |
sits. |
| 85 |
|
| 86 |
<p>Specify the color (<i>color</i>) as described for the <a |
| 87 |
href="libnetpbm_image.html#colorname">argument of the <b>pnm_parsecolor()</b> |
| 88 |
library routine</a>. |
| 89 |
|
| 90 |
<p>By default, if you don't specify this option, <b>pnmrotate</b> selects |
| 91 |
what appears to it to be the background color of the original image. It |
| 92 |
determines this color rather simplistically, by taking an average of the colors |
| 93 |
of the two top corners of the image. |
| 94 |
|
| 95 |
<p>This option was new in Netpbm 10.15. Before that, <b>pnmrotate</b> |
| 96 |
always behaved as is the default now. |
| 97 |
|
| 98 |
<dt><b>-noantialias</b> |
| 99 |
|
| 100 |
<dd>This option forces <b>pnmrotate</b> to simply move pixels around instead |
| 101 |
of synthesizing output pixels from multiple input pixels. The latter could |
| 102 |
cause the output to contain colors that are not in the input, which may not |
| 103 |
be desirable. It also probably makes the output contain a large number of |
| 104 |
colors. If you need a small number of colors, but it doesn't matter if they |
| 105 |
are the exact ones from the input, consider using <b>pnmquant</b> on the |
| 106 |
output instead of using <b>-noantialias</b>. |
| 107 |
|
| 108 |
<p>Note that to ensure the output does not contain colors that are not |
| 109 |
in the input, you also must consider the background color. See the |
| 110 |
<b>-background</b> option. |
| 111 |
|
| 112 |
</dl> |
| 113 |
|
| 114 |
<h2 id="references">REFERENCES</h2> |
| 115 |
|
| 116 |
"A Fast Algorithm for General Raster Rotation" by Alan Paeth, |
| 117 |
Graphics Interface '86, pp. 77-81. |
| 118 |
|
| 119 |
<h2 id="seealso">SEE ALSO</h2> |
| 120 |
|
| 121 |
<a href="pnmshear.html">pnmshear</a>, |
| 122 |
<a href="pamflip.html">pamflip</a>, |
| 123 |
<a href="pnmquant.html">pnmquant</a>, |
| 124 |
<a href="pnm.html">pnm</a> |
| 125 |
|
| 126 |
<h2 id="author">AUTHOR</h2> |
| 127 |
|
| 128 |
Copyright (C) 1989, 1991 by Jef Poskanzer. |
| 129 |
|
| 130 |
<hr> |
| 131 |
<h2 id="index">Table Of Contents</h2> |
| 132 |
<ul> |
| 133 |
<li><a href="#synopsis">SYNOPSIS</a> |
| 134 |
<li><a href="#description">DESCRIPTION</a> |
| 135 |
<li><a href="#options">OPTIONS</a> |
| 136 |
<li><a href="#references">REFERENCES</a> |
| 137 |
<li><a href="#seealso">SEE ALSO</a> |
| 138 |
<li><a href="#author">AUTHOR</a> |
| 139 |
</ul> |
| 140 |
</body> |
| 141 |
</html> |