Debian Codegraph @

userguide/asciitopgm.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
2 <html><head><title>Asciitopgm User Manual</title></head>
3 <body>
4 <h1>asciitopgm</h1>
5 Updated: 15 January 2026
6 <br>
7
8 <a href="#index">Table Of Contents</a>
9
10 <h2>NAME</h2>
11 asciitopgm - convert ASCII graphics into a PGM
12
13 <h2 id="synopsis">SYNOPSIS</h2>
14
15 <pre>
16 <b>asciitopgm</b>
17 [<b>-divisor=</b><i>integer</i>]
18 <i>height</i> <i>width</i> [<i>asciifile</i>]
19
20 </pre>
21
22 <p>Minimum unique abbreviation of option is acceptable. You may use
23 double hyphens instead of single hyphen to denote options. You may use
24 white space in place of the equals sign to separate an option name
25 from its value.
26
27 <h2 id="description">DESCRIPTION</h2>
28
29 <p>This program is part of <a href="index.html">Netpbm</a>.
30
31 <p><b>asciitopgm</b> converts a text grayscale image to PGM. A text grayscale
32 image is a way that people generated a grayscale graphical image with a black
33 on white text printer in the early days. Each character printed is one
34 pixel. A large character such as a capital M is a dark pixel, while a
35 small character such as a period is a light pixel. A space is a fully white
36 pixel. The viewer stands far back from the printed page so as to blur the
37 text and sees a grayscale image. A common novelty use of the technique was to
38 print out a photograph of a person&apos;s face in text.
39
40 <p>Obviously, <b>asciitopgm</b> assumes a certain font in assigning a
41 brightness value to a character.
42
43 <p><b>asciitopgm</b> considers ASCII control characters to be all white
44 (except for newline, which is never a pixel but rather indicates the end of a
45 raster row as you would expect). For a lower case character, It assigns a
46 special brightnesses which has nothing to do with what it looks like printed.
47
48 <p><b>asciitopgm</b> takes the ASCII character code from the lower 7 bits of
49 each input byte. But it warns you if the most significant bit of any input
50 byte is not zero.
51
52 <p>The output image is <i>height</i> pixels high by <i>width</i> pixels wide,
53 truncating and padding with white on the right and bottom as necessary.
54
55 <p>In a sort of reminiscence of Fortran line printer carriage control,
56 where a line starts with <b>+</b> (plus), <b>asciitopgm</b> combines it
57 with the previous row of output instead of generating a new row. This
58 allows a larger range of gray values. (In Fortran carriage control, the
59 first character of every line sent to the printer tells how much to advance
60 the paper, with <b>+</b> meaning not at all, so that the rest of the
61 characters on the line overstrike the ones already on the paper. What
62 <b>asciitopgm</b> does is rather different in that <b>asciitopgm</b> does not
63 reserve the first character of every line that way. If the first character is
64 anything but <b>+</b>, <b>asciitopgm</b> considers it just to be the first
65 character of the image.
66
67 <p>The maxval of the output image is 127.
68
69 <p>If you're looking for something that creates an image of text,
70 with that text specified in ASCII, that is something quite different.
71 Use <b>pbmtext</b> for that.
72
73
74 <h2 id="options">OPTIONS</h2>
75
76 <p>In addition to the options common to all programs based on libnetpbm
77 (most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
78 Common Options</a>), <b>asciitopgm</b> recognizes the following
79 command line option:
80
81 <dl compact>
82 <dt><b>-divisor=</b><i>integer</i>
83
84 <dd>Specify the value by which the blackness of an input character is divided.
85 This is an integer value. Larger values produce brighter output images.
86
87 <p>The value must be positive.
88
89 <p>The default value is 1.
90
91 <p>You can use this to adjust the brightness of the output: for example, if
92 the image is too dark, increase the divisor.
93
94 <p>Before Netpbm 11.14 (March 2006), this must be abbreviated <b>-d</b>,
95 separated from its value by a space and not an equals sign, and appear before
96 the non-option arguments.
97
98 </dl>
99
100 <h2 id="seealso">SEE ALSO</h2>
101
102 <a href="pbmtoascii.html">pbmtoascii</a>,
103 <a href="pbmtext.html">pbmtext</a>,
104 <a href="pgm.html">pgm</a>
105
106 <h2 id="author">AUTHOR</h2>
107
108 Wilson H. Bent. Jr. (<a href="mailto:[email protected]">[email protected]</a>)
109
110 <hr>
111 <h2 id="index">Table Of Contents</h2>
112 <ul>
113 <li><a href="#synopsis">SYNOPSIS</a>
114 <li><a href="#description">DESCRIPTION</a>
115 <li><a href="#options">OPTIONS</a>
116 <li><a href="#seealso">SEE ALSO</a>
117 <li><a href="#author">AUTHOR</a>
118 </ul>
119 </body>
120 </html>