And Finally, A 2-Bit Grayscale Image of Teddy Roosevelt with 6 Bits of Compression
For my final trick this evening, I decided to see what would happen if I applied some pixel-level compression a la Audrey Hepburn to a grayscale image. Of course, I’m working with the bare-bones of grayscale, having only four levels of value: white, light gray, dark gray and black. That allows me to clump the pixels in triplets: 4 values x 4 values x 4 values = 64 encodings. So the encoding here is similar to Audrey’s, but instead of encoding “white-black-black-white-white-black”, the letter “P” now encodes “light gray – dark gray – light gray”.
The practical upshot of all this is that I could encode a 2-bit grayscale image of Teddy Roosevelt at 15 x 26 pixels and still fit it in a tweet. Here’s what the Rough Rider looks thus rendered:
Which is actually pretty recognizable, if not as Theodore Roosevelt, then at least a middle-aged white guy in a suit. That’s pretty good for only 140 bytes. Here he is embiggened:
Here are his compressed pixel values still in a grid:
and, finally, his resulting tweet, with an information blurb included:
QvRfKMfbb5MwsgLNkhbLNwka5NkRfPAfI!aBc2gGgMHP1hV1a6ghQgQh 2bG 15x26