Posted on Sunday, December 7 2014 by Ionică Bizău
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.
You have to install GraphicsMagick before using this package:
$ sudo apt-get install graphicsmagick # Ubuntu
$ brew install graphicsmagick # Mac OS X
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:
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.