Skip to main content
2 of 2
added 50 characters in body
M--
  • 35.4k
  • 12
  • 77
  • 118
  1. Three may keep a secret, if two of them are dead.
  2. Key / Kite

Solution in HTML/JS running in the browser and using canvas to read/write image data (requires accounting for the alpha channel)

Code:

<script>
  function decode(url) {
    const img = new Image()
    img.crossOrigin = 'anonymous'
    img.onload = () => {
      const canvas = document.createElement('canvas')
      canvas.width = img.width
      canvas.height = img.height
      const ctx = canvas.getContext('2d')
      ctx.drawImage(img, 0, 0)
      const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data
      let bin = [...data.filter((b, i) => (i+1) % 4).map(b => b & 1)]
      if (bin[0] == 0) {
        bin = bin.slice(18)
    let out = ''
    while (bin.length)
      out += String.fromCharCode(parseInt(bin.splice(0, 8).join(''), 2))
    console.log(url, out)
      } else {
    bin = bin.slice(2)
    canvas.width = parseInt(bin.splice(0, 16).join(''), 2)
    canvas.height = parseInt(bin.splice(0, 16).join(''), 2)
    const out = new Uint8ClampedArray(canvas.width * canvas.height * 4)
    for (let i = 0; i < out.length; i += 4)
      out[i] = out[i + 1] = out[i + 2] = out[i + 3] = !bin[i / 4] * 128
    ctx.putImageData(new ImageData(out, canvas.width), 0, 0);
    document.body.appendChild(canvas)
      }
    }
    img.src = url
  }
    
  decode('https://i.sstatic.net/1RtT7h3L.png')
  decode('https://i.sstatic.net/EKD3bBZP.png')
  decode('https://i.sstatic.net/bmDwolWU.png')
  decode('https://i.sstatic.net/MBlXyTSp.png')
  decode('https://i.sstatic.net/mCeETXDs.png')
</script>

Run in ediKing online editor