This program is part of Netpbm.
asciitopgm reads ASCII data as input and produces a PGM image with pixel values which are an approximation of the "brightness" of the ASCII characters, assuming black-on-white printing. In other words, a capital M is very dark, a period is very light, and a space is white.
Obviously, asciitopgm assumes a certain font in assigning a brightness value to a character.
asciitopgm considers ASCII control characters to be all white. It assigns special brightnesses to lower case letters which have nothing to do with what they look like printed. asciitopgm takes the ASCII character code from the lower 7 bits of each input byte. But it warns you if the most signficant bit of any input byte is not zero.
Input lines which are fewer than width characters are automatically padded with spaces.
The divisor value is an integer (decimal) by which the blackness of an input character is divided; the default value is 1. You can use this to adjust the brightness of the output: for example, if the image is too bright, increase the divisor.
In keeping with (I believe) Fortran line-printer conventions, input lines beginning with a + (plus) character are assumed to "overstrike" the previous line, allowing a larger range of gray values.
If you're looking for something that creates an image of text, with that text specified in ASCII, that is something quite different. Use pbmtext for that.