LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

asciitopgm

Convert ASCII art to PGM grayscale image

TLDR

Convert ASCII art to PGM (note: height comes before width)
$ asciitopgm [height] [width] < [ascii.txt] > [output.pgm]
copy
Brighten the output with a divisor
$ asciitopgm -divisor=[2] [height] [width] [ascii.txt] > [output.pgm]
copy

SYNOPSIS

asciitopgm [-divisor=integer] height width [asciifile]

DESCRIPTION

asciitopgm converts ASCII art text to PGM (Portable Graymap) image format. Each character becomes one pixel; a large character such as a capital M produces a dark pixel, while a small one such as a period produces a light pixel.This is useful for converting legacy ASCII artwork to image formats or for creating images from text patterns. Output values range from 0 to a maximum of 127.

PARAMETERS

height

Output image height in pixels (number of rows)
width
Output image width in pixels (number of columns)
asciifile
Input ASCII file (reads from stdin if omitted)
-divisor integer
Divide each character's blackness value, brightening the output. Default is 1; larger positive values produce brighter images.

INSTALL

sudo apt install netpbm
copy
sudo dnf install netpbm
copy
sudo pacman -S netpbm
copy
sudo apk add netpbm
copy
sudo zypper install netpbm
copy
brew install netpbm
copy
nix profile install nixpkgs#netpbm
copy

CAVEATS

Character-to-grayscale mapping may not produce optimal results for all ASCII art styles. Output dimensions must be specified manually.

HISTORY

asciitopgm is part of the Netpbm image processing toolkit, which evolved from PBMPLUS in the late 1980s.

SEE ALSO

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid