2 ms·
So, I was bored after seeing this last week when I submitted it to HN, and so I whipped up a quick python script to shove code in to a BMP file. I bashed it ou
by mrcharles 16y ago
So, I was bored after seeing this last week when I submitted it to HN, and so I whipped up a quick python script to shove code in to a BMP file. I bashed it out quick and didn't bother cleaning it up, but here it is:
https://github.com/mrcharles/codemap https://github.com/mrcharles/codemap
Output from image.py: http://www.bluh.org/codemap.bmp http://www.bluh.org/codemap.bmp
Sadly there's still a bug, I think it has to do with alignment padding, which causes a null byte every 520 characters. When I get bored I'll fix it.
I think I'm going to write code though to try and make "pretty" images from source code, though in the end it won't be human readable when you open the file.
- lloeki 16y agoMake the image width a multiple of four? (thanks to this comment http://news.ycombinator.com/item?id=2415202 http://news.ycombinator.com/item?id=2415202)
- mrcharles 16y agoYeah, I know that's the fix, I'm just too lazy to do it. When I belted it out I forgot to think about that and then I didn't notice the nulls until someone pointed them out. Oops.