Turn images into braille text.
npm install brailleify --savefunction brailleify(image, options = {})imageis a browser canvas context object, or a Jimp image bitmap.optionsis an object with the following options:align: Booleanuses a non-space braille character to keep the image aligned vertically. Default istrue.invert: Booleanswitches the mapping of braille characters so darker regions are mapped to fewer dots, and vice versa. Default isfalse.threshold: Integeraffects the overall "shade" of the braille, ranging from 0-255. Default is120.scale: Integerdetermines the scale of the image pixels to the braille dots. 1 means 1 pixel per dot, 2 means 4 pixels per dot, and so on. Default is4.
var Jimp = require('jimp');
var brailleify = require('brailleify');
Jimp.read('./joy.png')
.then(image => brailleify(image.bitmap, {threshold: 122, scale: 2}))
.then(console.log);⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠏⠃⠁⢀⢀⢀⢀⢀⢀⢀⢀⢀⠃⠋⠯⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⠟⠇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠃⠯⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⠟⠁⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠂⠯⣿⣿⣿⣿⣿
⣿⣿⣿⣿⠇⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠂⢿⣿⣿⣿
⣿⣿⡿⠁⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢯⣿⣿
⣿⣿⠅⢀⢀⢀⢀⢀⣠⣰⡰⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢰⣰⣐⡀⢀⢀⢀⢀⠂⣿⣿
⣿⡟⢀⢀⢀⢀⣠⡿⠇⠁⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⠋⢿⣴⢀⢀⢀⢀⣪⣿
⣿⡕⢀⢀⢀⣪⠗⢀⣠⣸⣼⣼⣼⣼⣰⡀⢀⢀⢀⢀⢀⣠⣸⣼⣼⣼⣼⣰⡀⠋⢵⢀⢀⢀⠃⣿
⣿⡕⢀⢀⢀⢀⢀⠊⠇⠃⠃⢀⠂⠃⠃⠇⢀⢀⢀⢀⠂⠇⠃⠃⢀⠂⠃⠋⠏⢀⢀⢀⢀⢀⢀⣿
⣿⣕⣕⡀⢀⢀⢀⡼⠴⣰⣐⣀⣀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣀⣠⣰⠸⣼⢀⢀⢀⢀⢀⢯⣿
⡿⡯⠇⢀⢀⢀⢀⢭⢀⢀⢀⠃⠃⠃⠃⠏⠏⠏⠏⠏⠏⠃⠃⠃⠃⢀⢀⢀⡞⢀⢀⢀⢀⠉⢾⢿
⠃⢀⢀⢀⢀⢀⡀⠂⢽⣼⣰⣰⣀⣀⣀⣀⢀⢀⢀⢀⣀⣀⣀⣠⣰⣰⣼⡞⢀⢀⢀⢀⢀⢀⢀⠃
⣐⢀⢀⢀⢀⢀⢀⢀⢀⠋⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠇⢀⢀⢀⢀⢀⢀⢀⢀⢠
⣿⣽⣰⣰⣸⣘⢐⢀⢀⢀⢀⠋⠯⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠇⢀⢀⢀⢀⣠⢤⣴⣰⣰⣼⣿
⣿⣿⣿⣿⣿⣿⣽⣙⡰⡀⢀⢀⢀⢀⢀⠃⠃⠃⠃⠃⠃⢀⢀⢀⢀⢀⢀⡠⣦⣽⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣙⣤⠰⣀⡀⢀⢀⢀⢀⢀⢀⢀⣀⡠⢘⣤⣹⣾⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣼⣷⣳⣳⣳⣳⣳⣽⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿