Created
December 5, 2016 13:43
-
-
Save IGI-111/872ef205a7b0c5d93ab5046e858692c9 to your computer and use it in GitHub Desktop.
Make a QR code with braille characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const qr = require('qrcode'); | |
const Canvas = require('drawille'); | |
qr.drawBitArray(process.argv[2], (err,bits,width) => { | |
if(err){ | |
console.error(err); | |
return; | |
} | |
let height = Math.ceil(bits.length / width); | |
let canvas = new Canvas(width, height); | |
for (let x = 0; x < width; ++x) { | |
for (let y = 0; y < height; ++y) { | |
if(bits[y * width + x]){ | |
canvas.set(x, y); | |
} | |
} | |
} | |
process.stdout.write(canvas.frame()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment