Converting your logo to ASCII art
If you're a geek like me or you've just seen Iron Man 2 you'll probably like the idea of having a custom motd display something cool when you login to your shell or terminal server.
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
Gallush logo and to make it easier we’ll rehost the original image. Let’s go…
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:
- aalib – outdated
- jpeg2ascii – unfinished
- jp2a – easy to install on FreeBSD
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:
So as you can see, you can make out the logo pretty clearly and it fits on the screen! Pretty cool huh?
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: