TastyOs t1_iye2797 wrote
Reply to comment by ChadlyThe3rd in TIL The inventor of the television was a 15 year old farm boy who got the idea for scanning an image in rows from the back and forth motion of plowing a field. by chapstickninja
I’m a CS student too. Curious what algorithm the pool inspired you with
ChadlyThe3rd t1_iyed20u wrote
The walls of the pool were tiled and from a distance it looked fine, but up close you could see minor differences in glaze or calcium buildup between the tiles. Some tiles had even been replaced with similar but not identical color tiles. I got to thinking about how they kind of resembled pixels.
From there I started thinking about pixels and how we represent colors as numbers, and how you could store data in a photo in an undetectable to the naked eye way. Depending on the data format we store different things for colors. Sometimes it’s RBGA like with PNG FILES. sometimes RBG.
You can go and set all Alpha numbers down to to the nearest even and you can then store one bit per pixel while losing minimal information in the image. If you were to set every value, R, G, B or A down to an even (just the value there -1 If odd). You lose slightly more data but still invisible to the naked eye and you can store 4 bits per pixel. This is essentially editing the Least Significant Bit (LSB) of each piece of information.
From there we can say that we have 1 byte = 2 pixels. And since each ascii char is a byte we can store 1 character every 2 pixels. You simply encode or decode the photo to retrieve or place the message.
Thus all you need to send messages is a way to send photos without the host/platform downsizing them/compressing them.
This technique is a subset of something called steganography, or hiding messages in plain sight, and is an alternative to cryptography. There is a lot of interesting study in detecting this (as it can be used by terrorists, bad actors, etc) and of course you could always encrypt your message you hide using steganography for added security.
I wrote some fun code to try and make it undetectable. Eg adding noise to the rest of the photo. Trying to evenly space out where I hid my bits in pixels, adding a “key” at a random spot on the file that would tell me what pixel to start and stop at. Very fun way to learn about image formats!
Viewing a single comment thread. View all comments