
aalib.js is a dependency-free JavaScript library that automatically converts images and videos into static or moving ASCII art.
Install it via NPM:
$ npm install aalib.js --save
How to use it:
Install and import the aalib.js library into your project.
<script src="aalib.js"></script>
Convert an image into ASCII Art:
aalib.read.image.fromURL("sample.png")
.pipe(aalib.aa({ width: 200, height: 160 }))
.pipe(aalib.render.html())
.pipe(function (el) {
document.body.appendChild(el);
})
.end();Convert an HTML5 video into ASCII art using canvas:
<video src="sample.mp4" controls></video> <canvas id="video-scene"></canvas>
aalib.read.video.fromVideoElement(document.querySelector("video"))
.pipe(aalib.aa({ width: 165, height: 68 }))
.pipe(aalib.render.canvas({
width: 696,
height: 476,
el: document.querySelector("#video-scene")
}))
.end();Changelog:
10/10/2018
- v2.0.0







