asciitoppm
Convert ASCII art to PPM image
SYNOPSIS
asciitoppm [width] [height] [<inputfile] > output.ppm
PARAMETERS
width
Desired output image width in pixels (default: 128)
height
Desired output image height in pixels (default: scaled to preserve aspect ratio)
DESCRIPTION
asciitoppm is a command-line utility from the Netpbm graphics toolkit that converts ASCII art graphics into a grayscale PPM (Portable Pixmap) image. It reads lines of ASCII characters from standard input (or an input file) and maps each character to a specific intensity level, rendering them as pixels in the output image.
The tool supports 70 distinct characters, ordered from darkest (@, $, etc.) to lightest (space, quotes, etc.), allowing detailed shading in ASCII art. Users can specify the output image dimensions to control scaling. If no width is provided, the default is 128 pixels wide; height is then computed to preserve the aspect ratio of the input, assuming square pixels. This scaling ensures the artwork retains its proportions when viewed as an image.
Ideal for preserving and modernizing vintage ASCII art from bulletin board systems (BBS) or early computing era, asciitoppm outputs raw PPM data to stdout, which can be piped to viewers like ppm or converters like pnmtopng. It's lightweight, fast, and requires no additional libraries beyond Netpbm.
CAVEATS
Input must use only recognized ASCII shading characters; unrecognized chars may map to medium gray. Large inputs or dimensions can exceed memory limits in older Netpbm versions. No color support—grayscale only.
CHARACTER MAPPING (DARKEST TO LIGHTEST)
$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,'\"^`.
SCALING BEHAVIOR
Each input character becomes a pixel block; the entire image is resampled to fit specified width and height using simple interpolation.
HISTORY
Part of the Netpbm suite, originally developed by Jef Poskanzer starting in 1988. asciitoppm added in early 1990s to handle ASCII-to-image conversion, evolving with Netpbm releases for Unix-like systems.
SEE ALSO
ppmtoascii(1), pbmtext(1), ppm(1), pnmtopng(1)


