Rambling about rustic_bitmap
15 Sep 2025
One of my projects I've enjoyed the most is rustic_bitmap[*]. Yes, it's rough, and there are definitely things I'd change, but hear me out.
[*]A Rust library for bitmap manipulation
It all started when I decided to learn Rust. After reading some documentation, I jumped in and tried writing termiv, an image viewer to display images and play videos directly on your terminal. To hold the image data, I decided to use a bitmap buffer, which the program would then print to the terminal. So I read up on the bitmap file format documentation to figure out how to access things like image width, height, and anything else I'd need.
I wrote a bunch of functions to access that data, but the program didn't quite work. Sometimes it displayed fine, other times the image was glitched or buggy, and I couldn't figure out why. Then, while re-reading the documentation, I came across this line:
'Each scan line is zero padded to the nearest 4-byte boundary. If the image has a width that is not divisible by four, say, 21 bytes, there would be 3 bytes of padding at the end of every scan line.'
And that's when it hit me. I had completely missed the padding. That's why it wasn't working properly. When the image had no padding it would render fine, otherwise it'd get buggy.
So I fixed that and went to sleep, satisfied.
Until...
'WAIT A SECOND, WHAT DO YOU MEAN THERE'S USELESS PADDING THERE? I COULD USE THAT TO HIDE DATA! NEW IDEA NEW IDEA NEW IDEA NEW IDEA'
But first, I'd need the bitmap library itself. Working on termiv gave me the foundation for what would become rustic_bitmap, so I reused some of the code and built a library for working with bitmap image files.
I played around with it for a while, generating images and experimenting. But then I remembered that idea I had earlier. So I got to work on it. Finished it. Named it 'bmpuzzle'.
And I ended up really liking that project, so I went on to build a few more steganography projects. It was fun.
I am not sure what else to say. Fun things are fun.