ASCII Graphics

Robert P. Munafo, 1999 Feb 3.


An "ASCII graphic" is a graphical image rendered entirely out of characters from the ASCII character set, usually in a monospace font. The illustrations in this encyclopedia are ASCII graphics. Following is a precise description of how they are generated.

A Mandelbrot image is drawn on a 350x350 grid using the distance estimator method, which generates a good line-art rendition. The pixel grid is broken up into character cells, each 5x12 pixels in size. Within each character cell, six blocks are defined, each 2x4 pixels in size. The rightmost column of pixels in each character cell is ignored. A six-bit pattern value is generated by doing a true-or-false test on each of the six blocks. The algorithm first takes only the upper-left pixel in each block. If the resulting pattern value is 0, the algorithm recomputes the pattern value using the boolean OR of four pixels within each block. Once a pattern value is achieved, a character is produced by looking up in a 64-entry table. Figure A shows the bit positions assigned to each of the six blocks when forming the pattern value, and Figure B shows the mapping from pattern values onto representational ASCII characters. (Note in particular that several ASCII characters are used more than once.)


Fig. A 32 16 8 4 2 1 Fig. B: Character corresponding to each pattern value 1 1 2 2 3 3 4 4 5 5 6 0 5 0 5 0 5 0 5 0 5 0 5 0 .,_-:/a-\ce-vrm':/d']//~(/("(/d`\;L~\))`\[L"\)b^7F%"T)$"(FC*#F@


The result is 30 lines of text, each containing 70 characters plus a newline. A total of 12320 bits of information is expressed in 2130 bytes of text.

Here are some examples of images produced by this method: Feigenbaum point, embedded Julia set, paramecia, R2, R2.C(1/2), Seahorse Valley.

See also color, drawing.



From the Mandelbrot Set Glossary and Encyclopedia, by Robert Munafo.     Mu-ency index


Creative Commons License This work is licensed under a Creative Commons Attribution 2.5 License .
WWW: http://www.mrob.com/
EMail: mrob at mrob com (If you aren't a spambot you can rewrite this yourself)
© 1996-2008 Robert P. Munafo.s.13