Skip to content

Instantly share code, notes, and snippets.

@arjunlol
Last active July 7, 2017 01:04
Show Gist options
  • Save arjunlol/f78dab1734e085906f0583af098ae846 to your computer and use it in GitHub Desktop.
Save arjunlol/f78dab1734e085906f0583af098ae846 to your computer and use it in GitHub Desktop.
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