Last active
July 7, 2017 01:04
-
-
Save arjunlol/f78dab1734e085906f0583af098ae846 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 getPixels = require("get-pixels"); | |
let hiddenMsg = new String | |
//cb triggered once image loaded | |
getPixels("http://www.northern.co//wp-content/themes/northern/images/puzzle.png", function(err, pixels) { | |
if(err) { | |
console.log("Bad image path") | |
return | |
} | |
let counter = 0; | |
pixels.data.forEach((pixel) => { | |
//only need RGB values, skip 4th pixel | |
if (counter === 3) { | |
counter=0; | |
return; | |
} | |
//convert integer to ASCII and concat to hidden msg | |
hiddenMsg += (String.fromCharCode(pixel)); | |
counter++ | |
}) | |
console.log(hiddenMsg) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment