1Ppmtoarbtxt User Manual(0) Ppmtoarbtxt User Manual(0)
2
3
4
6 ppmtoarbtxt - generate image in arbitrary text format from PPM image
7
8
10 ppmtoarbtxt bodyskl [-hd headskl] [-tl tailskl] [ppmfile]
11
12
14 This program is part of Netpbm(1).
15
16 ppmtoarbtxt generates simple text-based graphics formats based on for‐
17 mat descriptions given as input. A text-based graphics format is one
18 in which an image is represented by text (like PNM plain format, but
19 unlike PNM raw format).
20
21 ppmtoarbtxt reads a PPM image as input. For each pixel in the image,
22 ppmtoarbtxt writes the contents of the skeleton file bodyskl, with cer‐
23 tain substitutions based on the value of the pixel, to stdout. The
24 substitutions are as follows:
25
26
27
28 #(ired format blackref whiteref)
29 generates an integer in the range blackref to whiteref using
30 format representing the red intensity of the pixel. A red
31 intensity of 0 becomes blackref; a red intensity of maxval
32 becomes whiteref.
33
34 #(ired) is equivalent to #(ired %d 0 255).
35
36
37 #(igreen format blackref whiteref)
38 Same as #(ired..., but for green.
39
40
41 #(iblue format blackref whiteref)
42 Same as #(ired..., but for blue.
43
44
45 #(ilum format blackref whiteref)
46 Same as #(ired..., but representing the luminance value
47 (0.299*red + 0.587*green + 0.114*blue) of the pixel.
48
49
50 #(fred format blackref whiteref)
51 Same as #(ired..., but generates a floating point number instead
52 of an integer.
53
54 #(fred) is equivalent to #(fred %f 0.0 1.0).
55
56
57 #(fgreen format blackref whiteref)
58 Same as #(fred..., but for green.
59
60
61 #(fblue format blackref whiteref)
62 Same as #(fred..., but for blue.
63
64
65 #(flum format blackref whiteref)
66 Same as #(fred..., but representing the luminance value
67 (0.299*red + 0.587*green + 0.114*blue) of the pixel.
68
69
70
71 #(width)
72 Generates the width in pixels of the image.
73
74
75 #(height)
76 Generates the height in pixels of the image.
77
78
79
80 #(posx)
81 Generates the horizontal position of the pixel, in pixels from
82 the left edge of the image.
83
84
85 #(posy)
86 Generates the vertical position of the pixel, in pixels from the
87 top edge of the image.
88
89
90
91 If the skeleton file ends with a LF-character, ppmtoarbtxt ignores it
92 -- it does not include it in the output.
93
94
96 -hd headskl
97 This option causes ppmtoarbtxt to place the contents of the file
98 named headskl at the beginning of the output, before the first
99 pixel. It does the same substitutions as for bodyskl, except
100 substitutions based on a pixel value are undefined.
101
102
103 -tl tailskl
104 This option causes ppmtoarbtxt to place the contents of the file
105 named tailskl at the end of the output, after the last pixel.
106 It is analogous to -hd.
107
108
109
111 gray inversion
112 Here we generate a PGM plain-format image with gray inversion (like
113 ppmtopgm | pnminvert).
114
115 Contents of our head skeleton file:
116
117 P2
118 #(width) #(height)
119 255
120
121 Contents of our body skeleton file:
122
123 #(ilum %d 255 0)
124
125
126 povray file
127 Here we generate a povray file where each pixel is represented by a
128 sphere at location (x,y,z) = (posx,height-posy,luminance). The color
129 of the sphere is the color of the pixel.
130
131 Contents of our head skeleton:
132
133 #include 'colors.inc'
134 #include 'textures.inc'
135 camera {
136 location <#(width) * 0.6, #(height) * 0.7, 80>
137 look_at <#(width) * 0.5, #(height) * 0.5, 0>
138 }
139
140 light_source { <#(width) * 0.5, #(height) * 0.5, 25> color White
141 }
142
143 Contents of our body skeleton:
144
145 sphere { <#(posx),#(height)-#(posy),#(ilum %d 0 10)>, 0.5
146 texture {
147 pigment {
148 color rgb <#(fred),#(fgreen),#(fblue)>
149 }
150 finish {
151 phong 1
152 }
153 }
154 }
155
156
158 pnmtoplainpnm(1) ppm(1)
159
160
162 ppmtoarbtxt was added to Netpbm in Release 10.14 (March 2003). It
163 existed under the name ppmtotxt since 1995.
164
165
167 Copyright (C) 1995 by Peter Kirchgessner
168
169
170
171netpbm documentation 27 April 2003 Ppmtoarbtxt User Manual(0)