Ionică Bizău

Using NodeJS to convert images into ASCII art

I've released a new version of the image-to-ascii NodeJS package which is used for converting images into ASCII art.

It's super easy to use. Let's take a look.

Prerequisites

You have to install GraphicsMagick before using this package:

$ sudo apt-get install graphicsmagick # Ubuntu
$ brew install graphicsmagick         # Mac OS X

Usage

After the prerequisites are installed, you can install the module: npm install image-to-ascii. Then you can start ASCIIfying images.

Let's use this Octocat in our tests. The url of the image is https://octodex.github.com/images/saint-nicktocat.jpg.

So, to convert this image into ASCII art, you'll have to do:

require("image-to-ascii")("https://octodex.github.com/images/saint-nicktocat.jpg", function (err, result) {
    console.log(result);
})

The result is:

Saint Nicktocat

This is the default behavior. We can modify it using an object instead of a string.

Don't forget to browse the code and documentation on GitHub… and ASCIIfy the world!

Have feedback on this article? Let @IonicaBizau know on Twitter.

Have any questions? Feel free to ping me on Twitter.