Sure, you can use figlet to create a text banner, but how cool would it be if you could display your own logo instead. Right?
Can an image be converted into ASCII art?
First of all, let’s get our logo image. We’re going to use the
I started off by trying some online converts:
- GlassGiant ASCII Art Generator
- mastervb.net ASCII Art
- DeGraeve.com IMG2TXT
- lunatic.no Image to HTML/ASCII
- jennana.com JPG2ASCII
- ConvertHub.com (as text/html)
There’s a lot out there, which got me thinking…
What about software? Here’s the ASCII art converters I found:
What about scripts? There must be a PHP, Perl or Python script out there…
- JPG to ASCII Converter PHP snippet
- Image2Char PHP Class
- generating ASCII art from photographs in Python
- ppmascii (perl)
- Term::Caca – perl interface for libcaca (Colour AsCii Art library)
- aalib-perl project
Then a brainwave, I want the image to fit a standard terminal screen (80 columns by 24 rows, according to putty’s default settings).
Since 1 pixel (usually) equates ASCII character, to make the ASCII art fit the screen I should resize the image from 128x128px to 24x24px.
Unfortunately at that size (24×24) it makes it almost impossible to work out what it’s meant to be, while at double the size (48×48) you can still make out all the defining features of the image. This is the resized image.
After doing this, my favourite so far was from “converthub.com”, which results in something a little like this which is exactly 24 lines so should fit your standard console screen.
So here it is:
Just need to render some text in figlet and use PabloDraw to combine the two, and you should end up with something like this:
Note: I used the “Rounded” font on the patorjk.com Text Ascii Art Generator.
Here’s what that looks like over PuTTY: