I woke up one day saying “Hey, wouldn’t it be cool to convert a software to an image?”
When you google “convert files to bmp”, you’d either get links that converts an image from one format to another, or if you’re lucky, how to inject a malicious software (*COUGH*VIRUS*COUGH*BACKDOOR*COUGH).
I remember there was a post in my blog made by one of the ex-writers; SIGTERMer. Building an image out of a few MB-sized OS.
Because I couldn’t find a program that does that. I figured I’d do that myself.
So here it is, I made a C# project that can convert any file from its binary values to an BMP image representation of it.
Here’s how it happens:
- Read file’s data in Binary.
- Do some math magic to figure out the width and height
- Gets file length.
- Pad it with FF values (Or 255) until it has a square root has an integer value (No fractions).
- Square root the total size to get the width and height.
- Convert Binary values to Integers (As in, from 0 to 255).
- Do for-loop for each dimension (Which means two), have the height’s width divided by 3, because we’re using three bytes to represent a color (Each byte for a color in RGB mode).
- Save the result in BMP
I really don’t know how to explain what I wrote up there, I tried my best (And my English is bananas right now because I just woke up, wife forced me… Don’t ask).
If you have Visual Studio 2015 (Could work on earlier releases, but that’s what I used for this project), you can check my Github to download and compile it.
The image in this post is what “explorer.exe” looks like. I’ll have to refine and comment my code. But for the time being, I’m too excited to alter anything in my code. I’ll get to it eventually, but not now.
If you’re feeling artistic in a glitchy way, I think this will be very useful for you.