Encrypt text into an image

This small experiment allows you to generate an image that represents the text you write. Then you can save the generated image and send it to someonem who will be able to reconvert it to text on this same page. It can also be seen as a way of fitting a lot of text in a small image.

Convert text to image

Write something and click on Encode!

Or click here to get some Lorem ipsum

Encode!

the image will appear in the square right down here (it's very small..) - here on codepen you'll have to right click and "save target" on the download button as it won't allow opening links in a _blank target

DownLoad it
(right click + save target as)

Convert image to text

UpLoad a png file created with this page

Additional info

This is not really a secure way of encrypting, but I just wanted to try and see what I come up with. What the script does is the following:

  1. Reads the original text
  2. Converts the text in Hexadecimal format and groups them by three letters
  3. Each group will be a color (example #B220FF)
  4. Draws each color as a single pixel on a canvas (this means that each pixel of the final image represents three letters)
  5. Exports the canvas image as a png file though the toImageData() method
  6. When decoding it does the exact opposite (duh?!)

Thanks for reading!