1Pnmrotate User Manual(0) Pnmrotate User Manual(0)
2
3
4
6 pnmrotate - rotate a PNM image by some angle
7
8
10 pnmrotate [-noantialias] [-background=color] angle [pnmfile]
11
12
14 This program is part of Netpbm(1).
15
16 pnmrotate reads a PNM image as input. It rotates it by the specified
17 angle and produces the same kind of PNM image as output.
18
19 The input is the file named by pnmfile or Standard Input if you don't
20 specify pnmfile. The output goes to Standard Output.
21
22 The resulting image is a rectangle that contains the (rectangular)
23 input image within it, rotated with respect to its bottom edge. The
24 containing rectangle is as small as possible to contain the rotated
25 image. The background of the containing image is a single color that
26 pnmrotate determines to be the background color of the original image,
27 or that you specify explicitly.
28
29 angle is in decimal degrees (floating point), measured counter-clock‐
30 wise. It can be negative, but it should be between -90 and 90.
31
32 You should use pamflip instead for rotations that are a multiple of a
33 quarter turn. It is faster and more accurate.
34
35 For rotations greater than 45 degrees you may get better results if you
36 first use pamflip to do a 90 degree rotation and then pnmrotate less
37 than 45 degrees back the other direction.
38
39 The rotation algorithm is Alan Paeth's three-shear method. Each shear
40 is implemented by looping over the source pixels and distributing frac‐
41 tions to each of the destination pixels. This has an 'anti-aliasing'
42 effect - it avoids jagged edges and similar artifacts. However, it
43 also means that the original colors or gray levels in the image are
44 modified. If you need to keep precisely the same set of colors, you
45 can use the -noantialias option.
46
47 The program runs faster and uses less real memory with the -noantialias
48 option. It uses a large amount of virtual memory either way, as it
49 keeps a copy of the input image and a copy of the output image in mem‐
50 ory, using 12 bytes per pixel for each. But with -noantialias, it
51 accesses this memory sequentially in half a dozen passes, with only a
52 few pages of memory at a time required in real memory.
53
54 In contrast, without -noantialias, the program's real memory working
55 set size is one page per input image row plus one page per output image
56 row. Before Netpbm 10.16 (June 2003), -noantialias had the same memory
57 requirement.
58
59
61 All options can be abbreviated to their shortest unique prefix. You
62 may use two hyphens instead of one to designate an option. You may use
63 either white space or equals signs between an option name and its
64 value.
65
66
67
68 -background=color
69 This determines the color of the background on which the rotated
70 image sits.
71
72 Specify the color (color) as described for the argument of the
73 ppm_parsecolor() library routine ⟨libppm.html#colorname⟩ .
74
75 By default, if you don't specify this option, pnmrotate selects
76 what appears to it to be the background color of the original
77 image. It determines this color rather simplisticly, by taking
78 an average of the colors of the two top corners of the image.
79
80 This option was new in Netpbm 10.15. Before that, pnmrotate
81 always behaved as is the default now.
82
83
84 -noantialias
85 This option forces pnmrotate to simply move pixels around
86 instead of synthesizing output pixels from multiple input pix‐
87 els. The latter could cause the output to contain colors that
88 are not in the input, which may not be desirable. It also prob‐
89 ably makes the output contain a large number of colors. If you
90 need a small number of colors, but it doesn't matter if they are
91 the exact ones from the input, consider using pnmquant on the
92 output instead of using -noantialias.
93
94 Note that to ensure the output does not contain colors that are
95 not in the input, you also must consider the background color.
96 See the -background option.
97
98
99
100
102 'A Fast Algorithm for General Raster Rotation' by Alan Paeth, Graphics
103 Interface '86, pp. 77-81.
104
105
107 pnmshear(1), pamflip(1), pnmquant(1), pnm(1)
108
109
111 Copyright (C) 1989, 1991 by Jef Poskanzer.
112
113
114
115netpbm documentation 30 August 2002 Pnmrotate User Manual(0)