Last active
March 19, 2020 10:33
-
-
Save urish/bb1ca32b992b027d4f557dfb58b0d97f to your computer and use it in GitHub Desktop.
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 bmpjs = require('bmp-js'); | |
const fs = require('fs'); | |
const happyb = fs.readFileSync('./happy-birthday.bmp'); | |
const bitmap = bmpjs.decode(happyb); | |
for (x = 0; x < bitmap.width; x++) { | |
let line = ''; | |
for (y = 0; y < bitmap.height; y++) { | |
line += bitmap.data[y * bitmap.width * 4 + (bitmap.width - 1 - x) * 4 + 1] ? ' ' : '#'; | |
} | |
console.log(line); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment