42 Astoundingly Useful Scripts and Automations for the Macintosh

Astounding ASCII Art

ASCII art images created using the asciiArt script of 42 Astounding Scripts and Automations for the Macintosh.

Jerry Stratton

The seventies like a shooting star—Sunday, August 4th, 2019
Author in seventies space

This would have looked perfectly normal in the seventies. “The past is another country,” wrote Mark Steyn in Passing Parade, “but the Seventies is another planet.”

I have no idea what to think about this image. I found this very seventies cartoon art of stars and rainbows and had to turn it into ASCII art, and I did it by (a) overlaying it on a photo of myself (the same photo that went on the cover of 42 Astounding Scripts and which I also used for the pointillism example inside the book) and (b) using the large block from the UTF-8 character set: █ as the background character. By using the block instead of a space, the background takes on the color of the overlay; normally, the overlay disappears in places there is no photo underneath it.

Because the block character doesn’t reach all the way to the top and bottom of the line, it creates a weird windowshade effect.

Assuming you have a photo of yourself called “photo.jpg” and you’ve named the stars and rainbow “stars.png”, this is the command line script that will create the very strange seventies-style ASCII-ish art:

  • asciiArt photo.jpg --width 240 --quiet --save myspace.png --overlay stars.png --palette "@%#*=+:-.█" --bgcolor .8,.8,.5

Another interesting effect can be gotten by replacing the block character with, say, a question mark, or a zero.

If you want to experiment with non-ASCII characters in your ASCII art, the Terminal has access to characters you can’t type. Use the Edit menu, and Emoji and Symbols.

I normally avoid using non-ASCII characters with the asciiArt script. Non-ASCII characters often causes problems, because some of the non-ASCII characters are not a uniform width even in monospace fonts. This will cause distortion, sometimes severe, in the final image. Sadly, for example, emoji won’t work for ASCII art because of this. Which means that an ASCII image using nothing but smiley faces remains an impossible dream.

The normal form of ASCII art creation also does not work well on cartoony images such as the star-and-rainbow image I used as an overlay here. ASCII art requires photo-realistic images with lots of gradation of color to trigger varying characters. They can, on the other hand, work well with a sequential palette, where the image is created using some text that is meant to be read. Such as, perhaps, a quote from 2001: A Space Odyssey:

ASCII ramp—Thursday, August 1st, 2019

Paul Bourke provides a standard “character ramp” for photo to greyscale conversion, as well as a more convincing, shorter sequence.

Discovering Paul’s ordering of characters for creating ASCII art was the starting point for writing the asciiArt script in 42 Astounding Scripts. Because different fonts will have different densities, I’ve since written a script that takes a font and puts its characters in order; that’s what I ended up using in the script as it appears in the book.

And I’ll have more about the densitySort script later if you want to use fonts other than Menlo. Stay tuned!

Older posts